[usb:usb-testing 51/52] sound/usb/qcom/mixer_usb_offload.c:131:3: warning: 'sprintf' will always overflow; destination buffer has size 34, but format string expands to at least 38

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

 



tree:   https://git.kernel.org/pub/scm/linux/kernel/git/gregkh/usb.git usb-testing
head:   c26f6731b8da887f1fb92d4654da57a19a266466
commit: b8a7c987d82f97c4a9929a395923e5a2242cdaf5 [51/52] ALSA: usb-audio: qcom: Add USB offload route kcontrol
config: s390-allmodconfig (https://download.01.org/0day-ci/archive/20250215/202502150149.mKpbIR83-lkp@xxxxxxxxx/config)
compiler: clang version 19.1.3 (https://github.com/llvm/llvm-project ab51eccf88f5321e7c60591c5546b254b6afab99)
reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20250215/202502150149.mKpbIR83-lkp@xxxxxxxxx/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@xxxxxxxxx>
| Closes: https://lore.kernel.org/oe-kbuild-all/202502150149.mKpbIR83-lkp@xxxxxxxxx/

All warnings (new ones prefixed by >>):

   In file included from sound/usb/qcom/mixer_usb_offload.c:6:
   In file included from include/linux/usb.h:19:
   In file included from include/linux/device.h:32:
   In file included from include/linux/device/driver.h:21:
   In file included from include/linux/module.h:19:
   In file included from include/linux/elf.h:6:
   In file included from arch/s390/include/asm/elf.h:181:
   In file included from arch/s390/include/asm/mmu_context.h:11:
   In file included from arch/s390/include/asm/pgalloc.h:18:
   In file included from include/linux/mm.h:2224:
   include/linux/vmstat.h:504:43: warning: arithmetic between different enumeration types ('enum zone_stat_item' and 'enum numa_stat_item') [-Wenum-enum-conversion]
     504 |         return vmstat_text[NR_VM_ZONE_STAT_ITEMS +
         |                            ~~~~~~~~~~~~~~~~~~~~~ ^
     505 |                            item];
         |                            ~~~~
   include/linux/vmstat.h:511:43: warning: arithmetic between different enumeration types ('enum zone_stat_item' and 'enum numa_stat_item') [-Wenum-enum-conversion]
     511 |         return vmstat_text[NR_VM_ZONE_STAT_ITEMS +
         |                            ~~~~~~~~~~~~~~~~~~~~~ ^
     512 |                            NR_VM_NUMA_EVENT_ITEMS +
         |                            ~~~~~~~~~~~~~~~~~~~~~~
   include/linux/vmstat.h:524:43: warning: arithmetic between different enumeration types ('enum zone_stat_item' and 'enum numa_stat_item') [-Wenum-enum-conversion]
     524 |         return vmstat_text[NR_VM_ZONE_STAT_ITEMS +
         |                            ~~~~~~~~~~~~~~~~~~~~~ ^
     525 |                            NR_VM_NUMA_EVENT_ITEMS +
         |                            ~~~~~~~~~~~~~~~~~~~~~~
>> sound/usb/qcom/mixer_usb_offload.c:131:3: warning: 'sprintf' will always overflow; destination buffer has size 34, but format string expands to at least 38 [-Wformat-overflow]
     131 |                 sprintf(ctl_name, "USB Offload Playback Card Route PCM#%d",
         |                 ^
   sound/usb/qcom/mixer_usb_offload.c:147:3: warning: 'sprintf' will always overflow; destination buffer has size 34, but format string expands to at least 37 [-Wformat-overflow]
     147 |                 sprintf(ctl_name, "USB Offload Playback PCM Route PCM#%d",
         |                 ^
   5 warnings generated.


vim +/sprintf +131 sound/usb/qcom/mixer_usb_offload.c

   100	
   101	/**
   102	 * snd_usb_offload_create_ctl() - Add USB offload bounded mixer
   103	 * @chip: USB SND chip device
   104	 *
   105	 * Creates a sound control for a USB audio device, so that applications can
   106	 * query for if there is an available USB audio offload path, and which
   107	 * card is managing it.
   108	 */
   109	int snd_usb_offload_create_ctl(struct snd_usb_audio *chip)
   110	{
   111		struct usb_device *udev = chip->dev;
   112		struct snd_kcontrol_new *chip_kctl;
   113		struct snd_usb_substream *subs;
   114		struct snd_usb_stream *as;
   115		char ctl_name[34];
   116		int ret;
   117	
   118		list_for_each_entry(as, &chip->pcm_list, list) {
   119			subs = &as->substream[SNDRV_PCM_STREAM_PLAYBACK];
   120			if (!subs->ep_num || as->pcm_index > 0xff)
   121				continue;
   122	
   123			chip_kctl = &snd_usb_offload_mapped_card_ctl;
   124			chip_kctl->count = 1;
   125			/*
   126			 * Store the associated USB SND card number and PCM index for
   127			 * the kctl.
   128			 */
   129			chip_kctl->private_value = as->pcm_index |
   130						  chip->card->number << 16;
 > 131			sprintf(ctl_name, "USB Offload Playback Card Route PCM#%d",

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




[Index of Archives]     [Linux Media]     [Linux Input]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]     [Old Linux USB Devel Archive]

  Powered by Linux