diff options
author | Takashi Iwai <tiwai@suse.de> | 2023-09-15 10:28:01 +0200 |
---|---|---|
committer | Takashi Iwai <tiwai@suse.de> | 2023-09-15 13:22:16 +0200 |
commit | 28329936d1e2ff4b962daca1c943f0150890d51e (patch) | |
tree | 6917a5b70eb5de368cc7eef7d328c00d80587bd7 /sound/pci | |
parent | ALSA: firewire: Fix -Wformat-truncation warning for MIDI stream names (diff) | |
download | linux-28329936d1e2ff4b962daca1c943f0150890d51e.tar.xz linux-28329936d1e2ff4b962daca1c943f0150890d51e.zip |
ALSA: cmipci: Fix -Wformat-truncation warning
CMIPCI driver got compile warnings with -Wformat-truncation at a
couple of plain sprintf() usages. Use scnprintf() for filling the
longname string for avoiding the warnings.
Link: https://lore.kernel.org/r/20230915082802.28684-13-tiwai@suse.de
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Diffstat (limited to 'sound/pci')
-rw-r--r-- | sound/pci/cmipci.c | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/sound/pci/cmipci.c b/sound/pci/cmipci.c index 1415baac9c36..08e34b184780 100644 --- a/sound/pci/cmipci.c +++ b/sound/pci/cmipci.c @@ -3102,11 +3102,13 @@ static int snd_cmipci_create(struct snd_card *card, struct pci_dev *pci, } sprintf(card->shortname, "C-Media CMI%d", val); if (cm->chip_version < 68) - sprintf(modelstr, " (model %d)", cm->chip_version); + scnprintf(modelstr, sizeof(modelstr), + " (model %d)", cm->chip_version); else modelstr[0] = '\0'; - sprintf(card->longname, "%s%s at %#lx, irq %i", - card->shortname, modelstr, cm->iobase, cm->irq); + scnprintf(card->longname, sizeof(card->longname), + "%s%s at %#lx, irq %i", + card->shortname, modelstr, cm->iobase, cm->irq); if (cm->chip_version >= 39) { val = snd_cmipci_read_b(cm, CM_REG_MPU_PCI + 1); |