ALSA: xen: Fix -Wformat-truncation warning
authorTakashi Iwai <tiwai@suse.de>
Fri, 15 Sep 2023 08:27:58 +0000 (10:27 +0200)
committerTakashi Iwai <tiwai@suse.de>
Fri, 15 Sep 2023 11:21:35 +0000 (13:21 +0200)
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>
sound/xen/xen_snd_front_cfg.c

index 63b0398..55ecf76 100644 (file)
@@ -483,7 +483,7 @@ int xen_snd_front_cfg_card(struct xen_snd_front_info *front_info,
        *stream_cnt = 0;
        num_devices = 0;
        do {
-               snprintf(node, sizeof(node), "%d", num_devices);
+               scnprintf(node, sizeof(node), "%d", num_devices);
                if (!xenbus_exists(XBT_NIL, xb_dev->nodename, node))
                        break;