Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

ALSA: xen: Fix -Wformat-truncation warning

The compile warning with -Wformat-truncation at
xen_snd_front_cfg_card() is false-positive; the loop can be only for
SNDRV_PCM_DEVICES which is at most 32.

For suppressing the warning, replace snprintf() with scnprintf().
As stated in the above, truncation doesn't matter.

Link: https://lore.kernel.org/r/20230915082802.28684-10-tiwai@suse.de
Signed-off-by: Takashi Iwai <tiwai@suse.de>

+1 -1
+1 -1
sound/xen/xen_snd_front_cfg.c
··· 483 483 *stream_cnt = 0; 484 484 num_devices = 0; 485 485 do { 486 - snprintf(node, sizeof(node), "%d", num_devices); 486 + scnprintf(node, sizeof(node), "%d", num_devices); 487 487 if (!xenbus_exists(XBT_NIL, xb_dev->nodename, node)) 488 488 break; 489 489