All of lore.kernel.org
 help / color / mirror / Atom feed
* [linux-next:master 12822/12910] sound/core/ump.c:1194:53: warning: '%s' directive output may be truncated writing up to 127 bytes into a region of size 80
@ 2023-08-25 10:51 kernel test robot
  0 siblings, 0 replies; only message in thread
From: kernel test robot @ 2023-08-25 10:51 UTC (permalink / raw)
  To: Takashi Iwai; +Cc: oe-kbuild-all, Linux Memory Management List

tree:   https://git.kernel.org/pub/scm/linux/kernel/git/next/linux-next.git master
head:   6269320850097903b30be8f07a5c61d9f7592393
commit: 7266869cd146d5b98a659dad9afb747e90fc45ce [12822/12910] Merge branch 'for-next' of git://git.kernel.org/pub/scm/linux/kernel/git/tiwai/sound.git
config: x86_64-allyesconfig (https://download.01.org/0day-ci/archive/20230825/202308251844.1FuQYsql-lkp@intel.com/config)
compiler: gcc-12 (Debian 12.2.0-14) 12.2.0
reproduce: (https://download.01.org/0day-ci/archive/20230825/202308251844.1FuQYsql-lkp@intel.com/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 <lkp@intel.com>
| Closes: https://lore.kernel.org/oe-kbuild-all/202308251844.1FuQYsql-lkp@intel.com/

All warnings (new ones prefixed by >>):

   sound/core/ump.c: In function 'snd_ump_attach_legacy_rawmidi':
>> sound/core/ump.c:1194:53: warning: '%s' directive output may be truncated writing up to 127 bytes into a region of size 80 [-Wformat-truncation=]
    1194 |         snprintf(rmidi->name, sizeof(rmidi->name), "%s (MIDI 1.0)",
         |                                                     ^~
   sound/core/ump.c:1194:9: note: 'snprintf' output between 12 and 139 bytes into a destination of size 80
    1194 |         snprintf(rmidi->name, sizeof(rmidi->name), "%s (MIDI 1.0)",
         |         ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    1195 |                  ump->info.name);
         |                  ~~~~~~~~~~~~~~~
>> sound/core/ump.c:1194:53: warning: '%s' directive output may be truncated writing up to 127 bytes into a region of size 80 [-Wformat-truncation=]
    1194 |         snprintf(rmidi->name, sizeof(rmidi->name), "%s (MIDI 1.0)",
         |                                                     ^~
   sound/core/ump.c:1194:9: note: 'snprintf' output between 12 and 139 bytes into a destination of size 80
    1194 |         snprintf(rmidi->name, sizeof(rmidi->name), "%s (MIDI 1.0)",
         |         ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    1195 |                  ump->info.name);
         |                  ~~~~~~~~~~~~~~~
>> sound/core/ump.c:1194:53: warning: '%s' directive output may be truncated writing up to 127 bytes into a region of size 80 [-Wformat-truncation=]
    1194 |         snprintf(rmidi->name, sizeof(rmidi->name), "%s (MIDI 1.0)",
         |                                                     ^~
   sound/core/ump.c:1194:9: note: 'snprintf' output between 12 and 139 bytes into a destination of size 80
    1194 |         snprintf(rmidi->name, sizeof(rmidi->name), "%s (MIDI 1.0)",
         |         ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    1195 |                  ump->info.name);
         |                  ~~~~~~~~~~~~~~~
>> sound/core/ump.c:1160:63: warning: '%s' directive output may be truncated writing up to 127 bytes into a region of size between 21 and 23 [-Wformat-truncation=]
    1160 |                 snprintf(s->name, sizeof(s->name), "Group %d (%s)",
         |                                                               ^~
   In function 'fill_substream_names',
       inlined from 'snd_ump_attach_legacy_rawmidi' at sound/core/ump.c:1201:3:
   sound/core/ump.c:1160:17: note: 'snprintf' output between 11 and 140 bytes into a destination of size 32
    1160 |                 snprintf(s->name, sizeof(s->name), "Group %d (%s)",
         |                 ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    1161 |                          ump->legacy_mapping[s->number] + 1, ump->info.name);
         |                          ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   sound/core/ump.c: In function 'snd_ump_attach_legacy_rawmidi':
>> sound/core/ump.c:1160:63: warning: '%s' directive output may be truncated writing up to 127 bytes into a region of size between 21 and 23 [-Wformat-truncation=]
    1160 |                 snprintf(s->name, sizeof(s->name), "Group %d (%s)",
         |                                                               ^~
   In function 'fill_substream_names',
       inlined from 'snd_ump_attach_legacy_rawmidi' at sound/core/ump.c:1203:3:
   sound/core/ump.c:1160:17: note: 'snprintf' output between 11 and 140 bytes into a destination of size 32
    1160 |                 snprintf(s->name, sizeof(s->name), "Group %d (%s)",
         |                 ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    1161 |                          ump->legacy_mapping[s->number] + 1, ump->info.name);
         |                          ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~


vim +1194 sound/core/ump.c

b2bcbd031d34d1b Takashi Iwai 2023-08-24  1153  
1761f4cc114af53 Takashi Iwai 2023-08-24  1154  static void fill_substream_names(struct snd_ump_endpoint *ump,
1761f4cc114af53 Takashi Iwai 2023-08-24  1155  				 struct snd_rawmidi *rmidi, int dir)
1761f4cc114af53 Takashi Iwai 2023-08-24  1156  {
1761f4cc114af53 Takashi Iwai 2023-08-24  1157  	struct snd_rawmidi_substream *s;
1761f4cc114af53 Takashi Iwai 2023-08-24  1158  
1761f4cc114af53 Takashi Iwai 2023-08-24  1159  	list_for_each_entry(s, &rmidi->streams[dir].substreams, list)
1761f4cc114af53 Takashi Iwai 2023-08-24 @1160  		snprintf(s->name, sizeof(s->name), "Group %d (%s)",
b2bcbd031d34d1b Takashi Iwai 2023-08-24  1161  			 ump->legacy_mapping[s->number] + 1, ump->info.name);
1761f4cc114af53 Takashi Iwai 2023-08-24  1162  }
1761f4cc114af53 Takashi Iwai 2023-08-24  1163  
0b5288f5fe63eab Takashi Iwai 2023-05-23  1164  int snd_ump_attach_legacy_rawmidi(struct snd_ump_endpoint *ump,
0b5288f5fe63eab Takashi Iwai 2023-05-23  1165  				  char *id, int device)
0b5288f5fe63eab Takashi Iwai 2023-05-23  1166  {
0b5288f5fe63eab Takashi Iwai 2023-05-23  1167  	struct snd_rawmidi *rmidi;
0b5288f5fe63eab Takashi Iwai 2023-05-23  1168  	bool input, output;
b2bcbd031d34d1b Takashi Iwai 2023-08-24  1169  	int err, num;
0b5288f5fe63eab Takashi Iwai 2023-05-23  1170  
b2bcbd031d34d1b Takashi Iwai 2023-08-24  1171  	ump->out_cvts = kcalloc(SNDRV_UMP_MAX_GROUPS,
b2bcbd031d34d1b Takashi Iwai 2023-08-24  1172  				sizeof(*ump->out_cvts), GFP_KERNEL);
33cd7630782df22 Takashi Iwai 2023-06-23  1173  	if (!ump->out_cvts)
33cd7630782df22 Takashi Iwai 2023-06-23  1174  		return -ENOMEM;
0b5288f5fe63eab Takashi Iwai 2023-05-23  1175  
b2bcbd031d34d1b Takashi Iwai 2023-08-24  1176  	num = fill_legacy_mapping(ump);
b2bcbd031d34d1b Takashi Iwai 2023-08-24  1177  
0b5288f5fe63eab Takashi Iwai 2023-05-23  1178  	input = ump->core.info_flags & SNDRV_RAWMIDI_INFO_INPUT;
0b5288f5fe63eab Takashi Iwai 2023-05-23  1179  	output = ump->core.info_flags & SNDRV_RAWMIDI_INFO_OUTPUT;
0b5288f5fe63eab Takashi Iwai 2023-05-23  1180  	err = snd_rawmidi_new(ump->core.card, id, device,
b2bcbd031d34d1b Takashi Iwai 2023-08-24  1181  			      output ? num : 0, input ? num : 0,
0b5288f5fe63eab Takashi Iwai 2023-05-23  1182  			      &rmidi);
0b5288f5fe63eab Takashi Iwai 2023-05-23  1183  	if (err < 0) {
33cd7630782df22 Takashi Iwai 2023-06-23  1184  		kfree(ump->out_cvts);
0b5288f5fe63eab Takashi Iwai 2023-05-23  1185  		return err;
0b5288f5fe63eab Takashi Iwai 2023-05-23  1186  	}
0b5288f5fe63eab Takashi Iwai 2023-05-23  1187  
0b5288f5fe63eab Takashi Iwai 2023-05-23  1188  	if (input)
0b5288f5fe63eab Takashi Iwai 2023-05-23  1189  		snd_rawmidi_set_ops(rmidi, SNDRV_RAWMIDI_STREAM_INPUT,
0b5288f5fe63eab Takashi Iwai 2023-05-23  1190  				    &snd_ump_legacy_input_ops);
0b5288f5fe63eab Takashi Iwai 2023-05-23  1191  	if (output)
0b5288f5fe63eab Takashi Iwai 2023-05-23  1192  		snd_rawmidi_set_ops(rmidi, SNDRV_RAWMIDI_STREAM_OUTPUT,
0b5288f5fe63eab Takashi Iwai 2023-05-23  1193  				    &snd_ump_legacy_output_ops);
5f11dd938fe7657 Takashi Iwai 2023-08-24 @1194  	snprintf(rmidi->name, sizeof(rmidi->name), "%s (MIDI 1.0)",
5f11dd938fe7657 Takashi Iwai 2023-08-24  1195  		 ump->info.name);
0b5288f5fe63eab Takashi Iwai 2023-05-23  1196  	rmidi->info_flags = ump->core.info_flags & ~SNDRV_RAWMIDI_INFO_UMP;
0b5288f5fe63eab Takashi Iwai 2023-05-23  1197  	rmidi->ops = &snd_ump_legacy_ops;
0b5288f5fe63eab Takashi Iwai 2023-05-23  1198  	rmidi->private_data = ump;
0b5288f5fe63eab Takashi Iwai 2023-05-23  1199  	ump->legacy_rmidi = rmidi;
1761f4cc114af53 Takashi Iwai 2023-08-24  1200  	if (input)
1761f4cc114af53 Takashi Iwai 2023-08-24  1201  		fill_substream_names(ump, rmidi, SNDRV_RAWMIDI_STREAM_INPUT);
1761f4cc114af53 Takashi Iwai 2023-08-24  1202  	if (output)
1761f4cc114af53 Takashi Iwai 2023-08-24  1203  		fill_substream_names(ump, rmidi, SNDRV_RAWMIDI_STREAM_OUTPUT);
1761f4cc114af53 Takashi Iwai 2023-08-24  1204  
0b5288f5fe63eab Takashi Iwai 2023-05-23  1205  	ump_dbg(ump, "Created a legacy rawmidi #%d (%s)\n", device, id);
0b5288f5fe63eab Takashi Iwai 2023-05-23  1206  	return 0;
0b5288f5fe63eab Takashi Iwai 2023-05-23  1207  }
0b5288f5fe63eab Takashi Iwai 2023-05-23  1208  EXPORT_SYMBOL_GPL(snd_ump_attach_legacy_rawmidi);
0b5288f5fe63eab Takashi Iwai 2023-05-23  1209  #endif /* CONFIG_SND_UMP_LEGACY_RAWMIDI */
0b5288f5fe63eab Takashi Iwai 2023-05-23  1210  

:::::: The code at line 1194 was first introduced by commit
:::::: 5f11dd938fe7657899ca79b2ffc4d708e43f4737 ALSA: usb-audio: Attach legacy rawmidi after probing all UMP EPs

:::::: TO: Takashi Iwai <tiwai@suse.de>
:::::: CC: Takashi Iwai <tiwai@suse.de>

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

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2023-08-25 10:52 UTC | newest]

Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-08-25 10:51 [linux-next:master 12822/12910] sound/core/ump.c:1194:53: warning: '%s' directive output may be truncated writing up to 127 bytes into a region of size 80 kernel test robot

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.