mirror of
https://github.com/torvalds/linux.git
synced 2025-01-01 15:51:46 +00:00
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>
This commit is contained in:
parent
ea77850e98
commit
28329936d1
@ -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);
|
||||
|
Loading…
Reference in New Issue
Block a user