Skip to contentSkip to conversation

sound/core/ump.c:1259:69: warning: '%s' directive output may be truncated writing up to 11 bytes into a region of size between 4 and 22

PATCH kernel test robot 1 participant 1 message Nov 29, 2024

lore
Share & tools
lore

kernel test robot

author build bot
#0 lore raw
tree:   https://git.kernel.org/pub/scm/linux/kernel/git/tiwai/sound.git for-next
head:   9b5f8ee43e48c25fbe1a10163ec04343d750acd0
commit: e29e504e7890b9ee438ca6370d0180d607c473f9 [6/10] ALSA: ump: Indicate the inactive group in legacy substream names
config: alpha-allyesconfig (https://download.01.org/0day-ci/archive/20241130/[email protected]/config)
compiler: alpha-linux-gcc (GCC) 14.2.0
reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20241130/[email protected]/reproduce)

If you fix the issue in a separate patch/commit (i.e. not just a new version of the same patch/commit), kindly add following tags
| Reported-by: kernel test robot <[email protected]>
| Closes: https://lore.kernel.org/oe-kbuild-all/[email protected]/

All warnings (new ones prefixed by >>):

sound/core/ump.c: In function 'fill_substream_names':

>> sound/core/ump.c:1259:69: warning: '%s' directive output may be truncated writing up to 11 bytes into a region of size between 4 and 22 [-Wformat-truncation=]
    1259 |                 snprintf(s->name, sizeof(s->name), "Group %d (%.16s)%s",
         |                                                                     ^~
   sound/core/ump.c:1259:17: note: 'snprintf' output between 11 and 40 bytes into a destination of size 32
    1259 |                 snprintf(s->name, sizeof(s->name), "Group %d (%.16s)%s",
         |                 ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    1260 |                          idx + 1, name,
         |                          ~~~~~~~~~~~~~~
    1261 |                          ump->groups[idx].active ? "" : " [Inactive]");
         |                          ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

vim +1259 sound/core/ump.c

1246
1247 static void fill_substream_names(struct snd_ump_endpoint *ump,
1248 struct snd_rawmidi *rmidi, int dir)
1249 {
1250 struct snd_rawmidi_substream *s;
1251 const char *name;
1252 int idx;
1253
1254 list_for_each_entry(s, &rmidi->streams[dir].substreams, list) {
1255 idx = ump->legacy_mapping[s->number];
1256 name = ump->groups[idx].name;
1257 if (!*name)
1258 name = ump->info.name;

> 1259			snprintf(s->name, sizeof(s->name), "Group %d (%.16s)%s",

1260 idx + 1, name,
1261 ump->groups[idx].active ? "" : " [Inactive]");
1262 }
1263 }
1264

Signature · 2 lines
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests/wiki