Re: [PATCH] ALSA: usb-audio: mixer: Remove temporary string use in parse_clock_source_unit

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

 



On Wed, 13 Sep 2023 11:39:33 +0200,
Peter Ujfalusi wrote:
> 
> The kctl->id.name can be directly passed to snd_usb_copy_string_desc() and
> if the string has been fetched the suffix can be appended with the
> append_ctl_name() call.
> The temporary name string becomes redundant and can be removed.
> 
> This change will also fixes the following compiler warning/error (W=1):
> 
> sound/usb/mixer.c: In function ʽparse_audio_unitʼ:
> sound/usb/mixer.c:1972:29: error: ʽ Validityʼ directive output may be truncated writing 9 bytes into a region of size between 1 and 44 [-Werror=format-truncation=]
>  1972 |                          "%s Validity", name);
>       |                             ^~~~~~~~~
> In function ʽparse_clock_source_unitʼ,
>     inlined from ʽparse_audio_unitʼ at sound/usb/mixer.c:2892:10:
> sound/usb/mixer.c:1971:17: note: ʽsnprintfʼ output between 10 and 53 bytes into a destination of size 44
>  1971 |                 snprintf(kctl->id.name, sizeof(kctl->id.name),
>       |                 ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
>  1972 |                          "%s Validity", name);
>       |                          ~~~~~~~~~~~~~~~~~~~~
> cc1: all warnings being treated as errors
> 
> The warnings got brought to light by a recent patch upstream:
> commit 6d4ab2e97dcf ("extrawarn: enable format and stringop overflow warnings in W=1")
> 
> Signed-off-by: Peter Ujfalusi <peter.ujfalusi@xxxxxxxxxxxxxxx>

Thanks, applied now.


Takashi



[Index of Archives]     [ALSA User]     [Linux Audio Users]     [Pulse Audio]     [Kernel Archive]     [Asterisk PBX]     [Photo Sharing]     [Linux Sound]     [Video 4 Linux]     [Gimp]     [Yosemite News]

  Powered by Linux