Patch "ALSA: ump: Fix -Wformat-truncation warnings" has been added to the 6.5-stable tree

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



This is a note to let you know that I've just added the patch titled

    ALSA: ump: Fix -Wformat-truncation warnings

to the 6.5-stable tree which can be found at:
    http://www.kernel.org/git/?p=linux/kernel/git/stable/stable-queue.git;a=summary

The filename of the patch is:
     alsa-ump-fix-wformat-truncation-warnings.patch
and it can be found in the queue-6.5 subdirectory.

If you, or anyone else, feels it should not be added to the stable tree,
please let <stable@xxxxxxxxxxxxxxx> know about it.



commit 2894fabd5e30ddbb09bf3c321acd77d5f53723e3
Author: Takashi Iwai <tiwai@xxxxxxx>
Date:   Sat Aug 26 09:21:51 2023 +0200

    ALSA: ump: Fix -Wformat-truncation warnings
    
    [ Upstream commit 4aa69d64e43edb51a4ecff7d301e9f881eb2d3f5 ]
    
    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@xxxxxxxxx>
    Closes: https://lore.kernel.org/oe-kbuild-all/202308251844.1FuQYsql-lkp@xxxxxxxxx/
    Link: https://lore.kernel.org/r/20230826072151.23408-1-tiwai@xxxxxxx
    Signed-off-by: Takashi Iwai <tiwai@xxxxxxx>
    Signed-off-by: Sasha Levin <sashal@xxxxxxxxxx>

diff --git a/sound/core/ump.c b/sound/core/ump.c
index 9d6e3e748f7e7..1e4e1e428b205 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;



[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux