* [PATCH] ALSA: usb-audio: scarlett_gen2: Fix another -Wformat-truncation warning
@ 2023-09-19 7:12 Peter Ujfalusi
2023-09-19 7:19 ` Takashi Iwai
0 siblings, 1 reply; 4+ messages in thread
From: Peter Ujfalusi @ 2023-09-19 7:12 UTC (permalink / raw)
To: tiwai, perex; +Cc: alsa-devel
The recent enablement of -Wformat-truncation leads to a false-positive
warning for mixer_scarlett_gen2.c.
For suppressing the warning, replace snprintf() with scnprintf().
As stated in the above, truncation doesn't matter.
Fixes: 78bd8f5126f8 ("ALSA: usb-audio: scarlett_gen2: Fix -Wformat-truncation warning")
Signed-off-by: Peter Ujfalusi <peter.ujfalusi@linux.intel.com>
---
sound/usb/mixer_scarlett_gen2.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/sound/usb/mixer_scarlett_gen2.c b/sound/usb/mixer_scarlett_gen2.c
index e0242b38b3f7..23aab1947958 100644
--- a/sound/usb/mixer_scarlett_gen2.c
+++ b/sound/usb/mixer_scarlett_gen2.c
@@ -3195,8 +3195,8 @@ static int scarlett2_add_line_in_ctls(struct usb_mixer_interface *mixer)
/* Add input phantom controls */
if (info->inputs_per_phantom == 1) {
for (i = 0; i < info->phantom_count; i++) {
- snprintf(s, sizeof(s), fmt, i + 1,
- "Phantom Power", "Switch");
+ scnprintf(s, sizeof(s), fmt, i + 1,
+ "Phantom Power", "Switch");
err = scarlett2_add_new_ctl(
mixer, &scarlett2_phantom_ctl,
i, 1, s, &private->phantom_ctls[i]);
--
2.42.0
^ permalink raw reply related [flat|nested] 4+ messages in thread* Re: [PATCH] ALSA: usb-audio: scarlett_gen2: Fix another -Wformat-truncation warning
2023-09-19 7:12 [PATCH] ALSA: usb-audio: scarlett_gen2: Fix another -Wformat-truncation warning Peter Ujfalusi
@ 2023-09-19 7:19 ` Takashi Iwai
2023-09-19 7:22 ` Péter Ujfalusi
0 siblings, 1 reply; 4+ messages in thread
From: Takashi Iwai @ 2023-09-19 7:19 UTC (permalink / raw)
To: Peter Ujfalusi; +Cc: tiwai, perex, alsa-devel
On Tue, 19 Sep 2023 09:12:05 +0200,
Peter Ujfalusi wrote:
>
> The recent enablement of -Wformat-truncation leads to a false-positive
> warning for mixer_scarlett_gen2.c.
>
> For suppressing the warning, replace snprintf() with scnprintf().
> As stated in the above, truncation doesn't matter.
>
> Fixes: 78bd8f5126f8 ("ALSA: usb-audio: scarlett_gen2: Fix -Wformat-truncation warning")
> Signed-off-by: Peter Ujfalusi <peter.ujfalusi@linux.intel.com>
While I applied it now, I wonder why this didn't show up with my local
test. Which compiler are you using?
thanks,
Takashi
^ permalink raw reply [flat|nested] 4+ messages in thread* Re: [PATCH] ALSA: usb-audio: scarlett_gen2: Fix another -Wformat-truncation warning
2023-09-19 7:19 ` Takashi Iwai
@ 2023-09-19 7:22 ` Péter Ujfalusi
2023-09-19 7:41 ` Takashi Iwai
0 siblings, 1 reply; 4+ messages in thread
From: Péter Ujfalusi @ 2023-09-19 7:22 UTC (permalink / raw)
To: Takashi Iwai; +Cc: tiwai, perex, alsa-devel
On 19/09/2023 10:19, Takashi Iwai wrote:
> On Tue, 19 Sep 2023 09:12:05 +0200,
> Peter Ujfalusi wrote:
>>
>> The recent enablement of -Wformat-truncation leads to a false-positive
>> warning for mixer_scarlett_gen2.c.
>>
>> For suppressing the warning, replace snprintf() with scnprintf().
>> As stated in the above, truncation doesn't matter.
>>
>> Fixes: 78bd8f5126f8 ("ALSA: usb-audio: scarlett_gen2: Fix -Wformat-truncation warning")
>> Signed-off-by: Peter Ujfalusi <peter.ujfalusi@linux.intel.com>
>
> While I applied it now, I wonder why this didn't show up with my local
> test.
I wondered about the same thing...
> Which compiler are you using?
$ gcc --version
gcc (GCC) 13.2.1 20230801
--
Péter
^ permalink raw reply [flat|nested] 4+ messages in thread* Re: [PATCH] ALSA: usb-audio: scarlett_gen2: Fix another -Wformat-truncation warning
2023-09-19 7:22 ` Péter Ujfalusi
@ 2023-09-19 7:41 ` Takashi Iwai
0 siblings, 0 replies; 4+ messages in thread
From: Takashi Iwai @ 2023-09-19 7:41 UTC (permalink / raw)
To: Péter Ujfalusi; +Cc: tiwai, perex, alsa-devel
On Tue, 19 Sep 2023 09:22:58 +0200,
Péter Ujfalusi wrote:
>
>
>
> On 19/09/2023 10:19, Takashi Iwai wrote:
> > On Tue, 19 Sep 2023 09:12:05 +0200,
> > Peter Ujfalusi wrote:
> >>
> >> The recent enablement of -Wformat-truncation leads to a false-positive
> >> warning for mixer_scarlett_gen2.c.
> >>
> >> For suppressing the warning, replace snprintf() with scnprintf().
> >> As stated in the above, truncation doesn't matter.
> >>
> >> Fixes: 78bd8f5126f8 ("ALSA: usb-audio: scarlett_gen2: Fix -Wformat-truncation warning")
> >> Signed-off-by: Peter Ujfalusi <peter.ujfalusi@linux.intel.com>
> >
> > While I applied it now, I wonder why this didn't show up with my local
> > test.
>
> I wondered about the same thing...
>
> > Which compiler are you using?
>
> $ gcc --version
> gcc (GCC) 13.2.1 20230801
Ah mine is still gcc12, and this might be.
Takashi
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2023-09-19 7:43 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-09-19 7:12 [PATCH] ALSA: usb-audio: scarlett_gen2: Fix another -Wformat-truncation warning Peter Ujfalusi
2023-09-19 7:19 ` Takashi Iwai
2023-09-19 7:22 ` Péter Ujfalusi
2023-09-19 7:41 ` Takashi Iwai
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox