linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* sound/usb/mixer_scarlett_gen2.c:3135:48: error: ' Volume Control Playback Enum' directive output may be truncated writing 29 bytes into a region of size between 25 and 33
@ 2023-10-19 23:23 kernel test robot
  0 siblings, 0 replies; only message in thread
From: kernel test robot @ 2023-10-19 23:23 UTC (permalink / raw)
  To: Mark Rutland; +Cc: oe-kbuild-all, linux-kernel, Catalin Marinas

tree:   https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git master
head:   ce55c22ec8b223a90ff3e084d842f73cfba35588
commit: c27cd083cfb9d392f304657ed00fcde1136704e7 Compiler attributes: GCC cold function alignment workarounds
date:   9 months ago
config: x86_64-sof-customedconfig-memory-debug-defconfig (https://download.01.org/0day-ci/archive/20231020/202310200711.olDz9VTe-lkp@intel.com/config)
compiler: gcc-11 (Debian 11.3.0-12) 11.3.0
reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20231020/202310200711.olDz9VTe-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/202310200711.olDz9VTe-lkp@intel.com/

All errors (new ones prefixed by >>):

   sound/usb/mixer_scarlett_gen2.c: In function 'snd_scarlett_gen2_init':
>> sound/usb/mixer_scarlett_gen2.c:3135:48: error: ' Volume Control Playback Enum' directive output may be truncated writing 29 bytes into a region of size between 25 and 33 [-Werror=format-truncation=]
    3135 |                                  "Line Out %02d Volume Control Playback Enum",
         |                                                ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   sound/usb/mixer_scarlett_gen2.c:3134:25: note: 'snprintf' output between 41 and 49 bytes into a destination of size 44
    3134 |                         snprintf(s, sizeof(s),
         |                         ^~~~~~~~~~~~~~~~~~~~~~
    3135 |                                  "Line Out %02d Volume Control Playback Enum",
         |                                  ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    3136 |                                  i + 1);
         |                                  ~~~~~~
   sound/usb/mixer_scarlett_gen2.c:3175:54: error: '%s' directive output may be truncated writing 6 bytes into a region of size between 2 and 10 [-Werror=format-truncation=]
    3175 |         const char *fmt2 = "Line In %d-%d %s Capture %s";
         |                                                      ^~
   ......
    3222 |                                  "Phantom Power", "Switch");
         |                                                   ~~~~~~~~
   sound/usb/mixer_scarlett_gen2.c:3221:25: note: 'snprintf' output between 41 and 49 bytes into a destination of size 44
    3221 |                         snprintf(s, sizeof(s), fmt2, from, to,
         |                         ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    3222 |                                  "Phantom Power", "Switch");
         |                                  ~~~~~~~~~~~~~~~~~~~~~~~~~~
   cc1: all warnings being treated as errors


vim +3135 sound/usb/mixer_scarlett_gen2.c

9e4d5c1be21f0c Geoffrey D. Bennett 2019-07-29  3075  
9e4d5c1be21f0c Geoffrey D. Bennett 2019-07-29  3076  static int scarlett2_add_line_out_ctls(struct usb_mixer_interface *mixer)
9e4d5c1be21f0c Geoffrey D. Bennett 2019-07-29  3077  {
e46f2195c86b00 Geoffrey D. Bennett 2021-06-21  3078  	struct scarlett2_data *private = mixer->private_data;
9e4d5c1be21f0c Geoffrey D. Bennett 2019-07-29  3079  	const struct scarlett2_device_info *info = private->info;
e2cc91ac8f4e1b Geoffrey D. Bennett 2021-06-22  3080  	const int (*port_count)[SCARLETT2_PORT_DIRNS] = info->port_count;
9e4d5c1be21f0c Geoffrey D. Bennett 2019-07-29  3081  	int num_line_out =
e2cc91ac8f4e1b Geoffrey D. Bennett 2021-06-22  3082  		port_count[SCARLETT2_PORT_TYPE_ANALOGUE][SCARLETT2_PORT_OUT];
9e4d5c1be21f0c Geoffrey D. Bennett 2019-07-29  3083  	int err, i;
9e4d5c1be21f0c Geoffrey D. Bennett 2019-07-29  3084  	char s[SNDRV_CTL_ELEM_ID_NAME_MAXLEN];
9e4d5c1be21f0c Geoffrey D. Bennett 2019-07-29  3085  
9e4d5c1be21f0c Geoffrey D. Bennett 2019-07-29  3086  	/* Add R/O HW volume control */
9e4d5c1be21f0c Geoffrey D. Bennett 2019-07-29  3087  	if (info->line_out_hw_vol) {
9e4d5c1be21f0c Geoffrey D. Bennett 2019-07-29  3088  		snprintf(s, sizeof(s), "Master HW Playback Volume");
9e4d5c1be21f0c Geoffrey D. Bennett 2019-07-29  3089  		err = scarlett2_add_new_ctl(mixer,
9e4d5c1be21f0c Geoffrey D. Bennett 2019-07-29  3090  					    &scarlett2_master_volume_ctl,
9e4d5c1be21f0c Geoffrey D. Bennett 2019-07-29  3091  					    0, 1, s, &private->master_vol_ctl);
9e4d5c1be21f0c Geoffrey D. Bennett 2019-07-29  3092  		if (err < 0)
9e4d5c1be21f0c Geoffrey D. Bennett 2019-07-29  3093  			return err;
9e4d5c1be21f0c Geoffrey D. Bennett 2019-07-29  3094  	}
9e4d5c1be21f0c Geoffrey D. Bennett 2019-07-29  3095  
9e4d5c1be21f0c Geoffrey D. Bennett 2019-07-29  3096  	/* Add volume controls */
9e4d5c1be21f0c Geoffrey D. Bennett 2019-07-29  3097  	for (i = 0; i < num_line_out; i++) {
9cfe1276a6736f Geoffrey D. Bennett 2021-06-23  3098  		int index = line_out_remap(private, i);
9e4d5c1be21f0c Geoffrey D. Bennett 2019-07-29  3099  
9e4d5c1be21f0c Geoffrey D. Bennett 2019-07-29  3100  		/* Fader */
9e4d5c1be21f0c Geoffrey D. Bennett 2019-07-29  3101  		if (info->line_out_descrs[i])
9e4d5c1be21f0c Geoffrey D. Bennett 2019-07-29  3102  			snprintf(s, sizeof(s),
9e4d5c1be21f0c Geoffrey D. Bennett 2019-07-29  3103  				 "Line %02d (%s) Playback Volume",
9e4d5c1be21f0c Geoffrey D. Bennett 2019-07-29  3104  				 i + 1, info->line_out_descrs[i]);
9e4d5c1be21f0c Geoffrey D. Bennett 2019-07-29  3105  		else
9e4d5c1be21f0c Geoffrey D. Bennett 2019-07-29  3106  			snprintf(s, sizeof(s),
9e4d5c1be21f0c Geoffrey D. Bennett 2019-07-29  3107  				 "Line %02d Playback Volume",
9e4d5c1be21f0c Geoffrey D. Bennett 2019-07-29  3108  				 i + 1);
9e4d5c1be21f0c Geoffrey D. Bennett 2019-07-29  3109  		err = scarlett2_add_new_ctl(mixer,
9e4d5c1be21f0c Geoffrey D. Bennett 2019-07-29  3110  					    &scarlett2_line_out_volume_ctl,
9e4d5c1be21f0c Geoffrey D. Bennett 2019-07-29  3111  					    i, 1, s, &private->vol_ctls[i]);
9e4d5c1be21f0c Geoffrey D. Bennett 2019-07-29  3112  		if (err < 0)
9e4d5c1be21f0c Geoffrey D. Bennett 2019-07-29  3113  			return err;
9e4d5c1be21f0c Geoffrey D. Bennett 2019-07-29  3114  
0c88f9db1910ff Geoffrey D. Bennett 2021-06-22  3115  		/* Mute Switch */
0c88f9db1910ff Geoffrey D. Bennett 2021-06-22  3116  		snprintf(s, sizeof(s),
0c88f9db1910ff Geoffrey D. Bennett 2021-06-22  3117  			 "Line %02d Mute Playback Switch",
0c88f9db1910ff Geoffrey D. Bennett 2021-06-22  3118  			 i + 1);
0c88f9db1910ff Geoffrey D. Bennett 2021-06-22  3119  		err = scarlett2_add_new_ctl(mixer,
0c88f9db1910ff Geoffrey D. Bennett 2021-06-22  3120  					    &scarlett2_mute_ctl,
0c88f9db1910ff Geoffrey D. Bennett 2021-06-22  3121  					    i, 1, s,
0c88f9db1910ff Geoffrey D. Bennett 2021-06-22  3122  					    &private->mute_ctls[i]);
0c88f9db1910ff Geoffrey D. Bennett 2021-06-22  3123  		if (err < 0)
0c88f9db1910ff Geoffrey D. Bennett 2021-06-22  3124  			return err;
0c88f9db1910ff Geoffrey D. Bennett 2021-06-22  3125  
0c88f9db1910ff Geoffrey D. Bennett 2021-06-22  3126  		/* Make the fader and mute controls read-only if the
0c88f9db1910ff Geoffrey D. Bennett 2021-06-22  3127  		 * SW/HW switch is set to HW
0c88f9db1910ff Geoffrey D. Bennett 2021-06-22  3128  		 */
9cfe1276a6736f Geoffrey D. Bennett 2021-06-23  3129  		if (private->vol_sw_hw_switch[index])
06250c89d47cef Geoffrey D. Bennett 2021-06-22  3130  			scarlett2_vol_ctl_set_writable(mixer, i, 0);
9e4d5c1be21f0c Geoffrey D. Bennett 2019-07-29  3131  
9e4d5c1be21f0c Geoffrey D. Bennett 2019-07-29  3132  		/* SW/HW Switch */
9e4d5c1be21f0c Geoffrey D. Bennett 2019-07-29  3133  		if (info->line_out_hw_vol) {
9e4d5c1be21f0c Geoffrey D. Bennett 2019-07-29  3134  			snprintf(s, sizeof(s),
9e4d5c1be21f0c Geoffrey D. Bennett 2019-07-29 @3135  				 "Line Out %02d Volume Control Playback Enum",
9e4d5c1be21f0c Geoffrey D. Bennett 2019-07-29  3136  				 i + 1);
9e4d5c1be21f0c Geoffrey D. Bennett 2019-07-29  3137  			err = scarlett2_add_new_ctl(mixer,
9e4d5c1be21f0c Geoffrey D. Bennett 2019-07-29  3138  						    &scarlett2_sw_hw_enum_ctl,
f02da6534810ac Geoffrey D. Bennett 2021-06-23  3139  						    i, 1, s,
f02da6534810ac Geoffrey D. Bennett 2021-06-23  3140  						    &private->sw_hw_ctls[i]);
9e4d5c1be21f0c Geoffrey D. Bennett 2019-07-29  3141  			if (err < 0)
9e4d5c1be21f0c Geoffrey D. Bennett 2019-07-29  3142  				return err;
e914d8432cb4b9 Geoffrey D. Bennett 2021-06-23  3143  
e914d8432cb4b9 Geoffrey D. Bennett 2021-06-23  3144  			/* Make the switch read-only if the line is
e914d8432cb4b9 Geoffrey D. Bennett 2021-06-23  3145  			 * involved in speaker switching
e914d8432cb4b9 Geoffrey D. Bennett 2021-06-23  3146  			 */
e914d8432cb4b9 Geoffrey D. Bennett 2021-06-23  3147  			if (private->speaker_switching_switch && i < 4)
e914d8432cb4b9 Geoffrey D. Bennett 2021-06-23  3148  				scarlett2_sw_hw_ctl_ro(private, i);
9e4d5c1be21f0c Geoffrey D. Bennett 2019-07-29  3149  		}
9e4d5c1be21f0c Geoffrey D. Bennett 2019-07-29  3150  	}
9e4d5c1be21f0c Geoffrey D. Bennett 2019-07-29  3151  
dbd82c0550633c Geoffrey D. Bennett 2021-06-21  3152  	/* Add dim/mute controls */
03bdbcf08a8cb7 Geoffrey D. Bennett 2021-06-21  3153  	if (info->line_out_hw_vol)
dbd82c0550633c Geoffrey D. Bennett 2021-06-21  3154  		for (i = 0; i < SCARLETT2_DIM_MUTE_COUNT; i++) {
03bdbcf08a8cb7 Geoffrey D. Bennett 2021-06-21  3155  			err = scarlett2_add_new_ctl(
dbd82c0550633c Geoffrey D. Bennett 2021-06-21  3156  				mixer, &scarlett2_dim_mute_ctl,
dbd82c0550633c Geoffrey D. Bennett 2021-06-21  3157  				i, 1, scarlett2_dim_mute_names[i],
dbd82c0550633c Geoffrey D. Bennett 2021-06-21  3158  				&private->dim_mute_ctls[i]);
9e4d5c1be21f0c Geoffrey D. Bennett 2019-07-29  3159  			if (err < 0)
9e4d5c1be21f0c Geoffrey D. Bennett 2019-07-29  3160  				return err;
9e4d5c1be21f0c Geoffrey D. Bennett 2019-07-29  3161  		}
9e4d5c1be21f0c Geoffrey D. Bennett 2019-07-29  3162  
9e4d5c1be21f0c Geoffrey D. Bennett 2019-07-29  3163  	return 0;
9e4d5c1be21f0c Geoffrey D. Bennett 2019-07-29  3164  }
9e4d5c1be21f0c Geoffrey D. Bennett 2019-07-29  3165  

:::::: The code at line 3135 was first introduced by commit
:::::: 9e4d5c1be21f0c00e747e92186784f3298309b3e ALSA: usb-audio: Scarlett Gen 2 mixer interface

:::::: TO: Geoffrey D. Bennett <g@b4.vu>
:::::: 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-10-19 23:23 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-10-19 23:23 sound/usb/mixer_scarlett_gen2.c:3135:48: error: ' Volume Control Playback Enum' directive output may be truncated writing 29 bytes into a region of size between 25 and 33 kernel test robot

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).