summaryrefslogtreecommitdiffstats
path: root/sound/core
diff options
context:
space:
mode:
authorTakashi Iwai <tiwai@suse.de>2023-08-26 09:21:51 +0200
committerTakashi Iwai <tiwai@suse.de>2023-08-26 09:22:18 +0200
commit4aa69d64e43edb51a4ecff7d301e9f881eb2d3f5 (patch)
treecec7340bb7307cbd0ccd4e94a33a9e517d62b884 /sound/core
parentALSA: hda: Add missing dependency on CONFIG_EFI for Cirrus/TI sub-codecs (diff)
downloadlinux-4aa69d64e43edb51a4ecff7d301e9f881eb2d3f5.tar.xz
linux-4aa69d64e43edb51a4ecff7d301e9f881eb2d3f5.zip
ALSA: ump: Fix -Wformat-truncation warnings
Filling the rawmidi name and substream name can be truncated, and this leads to spurious compiler warnings due to -Wformat-truncation. Although the truncation is the expected behavior, it'd be better to truncate the string within "(...)" This patch puts the precision specifies to each %s for fitting the words within the size-limited strings. Fixes: 5f11dd938fe7 ("ALSA: usb-audio: Attach legacy rawmidi after probing all UMP EPs") Reported-by: kernel test robot <lkp@intel.com> Closes: https://lore.kernel.org/oe-kbuild-all/202308251844.1FuQYsql-lkp@intel.com/ Link: https://lore.kernel.org/r/20230826072151.23408-1-tiwai@suse.de Signed-off-by: Takashi Iwai <tiwai@suse.de>
Diffstat (limited to 'sound/core')
-rw-r--r--sound/core/ump.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/sound/core/ump.c b/sound/core/ump.c
index cd192bec227a..3bef1944e955 100644
--- a/sound/core/ump.c
+++ b/sound/core/ump.c
@@ -1157,7 +1157,7 @@ static void fill_substream_names(struct snd_ump_endpoint *ump,
struct snd_rawmidi_substream *s;
list_for_each_entry(s, &rmidi->streams[dir].substreams, list)
- snprintf(s->name, sizeof(s->name), "Group %d (%s)",
+ snprintf(s->name, sizeof(s->name), "Group %d (%.16s)",
ump->legacy_mapping[s->number] + 1, ump->info.name);
}
@@ -1191,7 +1191,7 @@ int snd_ump_attach_legacy_rawmidi(struct snd_ump_endpoint *ump,
if (output)
snd_rawmidi_set_ops(rmidi, SNDRV_RAWMIDI_STREAM_OUTPUT,
&snd_ump_legacy_output_ops);
- snprintf(rmidi->name, sizeof(rmidi->name), "%s (MIDI 1.0)",
+ snprintf(rmidi->name, sizeof(rmidi->name), "%.68s (MIDI 1.0)",
ump->info.name);
rmidi->info_flags = ump->core.info_flags & ~SNDRV_RAWMIDI_INFO_UMP;
rmidi->ops = &snd_ump_legacy_ops;