summaryrefslogtreecommitdiffstats
path: root/sound/isa
diff options
context:
space:
mode:
authorArnd Bergmann <arnd@arndb.de>2017-07-18 07:48:04 -0400
committerTakashi Iwai <tiwai@suse.de>2017-07-18 11:51:27 -0400
commit8a463639db5781ed52c972db013eba7d834f440d (patch)
tree0352797a26645b1b6e1fc804475377f5ff3e6c67 /sound/isa
parent610e1ae9b533be82b3aa118b907e0a703256913d (diff)
ALSA: als100: fix format string overflow warning
The compiler sees that the format string might overflow for the longname: sound/isa/als100.c: In function 'snd_als100_pnp_detect': sound/isa/als100.c:225:27: error: ', dma ' directive writing 6 bytes into a region of size between 0 and 64 [-Werror=format-overflow=] sprintf(card->longname, "%s, %s at 0x%lx, irq %d, dma %d", ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ sound/isa/als100.c:225:3: note: 'sprintf' output between 24 and 113 bytes into a destination of size 80 sprintf(card->longname, "%s, %s at 0x%lx, irq %d, dma %d", Open-coding "shortname" here gets us below the limit, and using snprintf() is a good idea too. Signed-off-by: Arnd Bergmann <arnd@arndb.de> Signed-off-by: Takashi Iwai <tiwai@suse.de>
Diffstat (limited to 'sound/isa')
-rw-r--r--sound/isa/als100.c13
1 files changed, 7 insertions, 6 deletions
diff --git a/sound/isa/als100.c b/sound/isa/als100.c
index bc9ea306ee02..6a2c5b48f3ae 100644
--- a/sound/isa/als100.c
+++ b/sound/isa/als100.c
@@ -222,15 +222,16 @@ static int snd_card_als100_probe(int dev,
222 if (pid->driver_data == SB_HW_DT019X) { 222 if (pid->driver_data == SB_HW_DT019X) {
223 strcpy(card->driver, "DT-019X"); 223 strcpy(card->driver, "DT-019X");
224 strcpy(card->shortname, "Diamond Tech. DT-019X"); 224 strcpy(card->shortname, "Diamond Tech. DT-019X");
225 sprintf(card->longname, "%s, %s at 0x%lx, irq %d, dma %d", 225 snprintf(card->longname, sizeof(card->longname),
226 card->shortname, chip->name, chip->port, 226 "Diamond Tech. DT-019X, %s at 0x%lx, irq %d, dma %d",
227 irq[dev], dma8[dev]); 227 chip->name, chip->port, irq[dev], dma8[dev]);
228 } else { 228 } else {
229 strcpy(card->driver, "ALS100"); 229 strcpy(card->driver, "ALS100");
230 strcpy(card->shortname, "Avance Logic ALS100"); 230 strcpy(card->shortname, "Avance Logic ALS100");
231 sprintf(card->longname, "%s, %s at 0x%lx, irq %d, dma %d&%d", 231 snprintf(card->longname, sizeof(card->longname),
232 card->shortname, chip->name, chip->port, 232 "Avance Logic ALS100, %s at 0x%lx, irq %d, dma %d&%d",
233 irq[dev], dma8[dev], dma16[dev]); 233 chip->name, chip->port, irq[dev], dma8[dev],
234 dma16[dev]);
234 } 235 }
235 236
236 if ((error = snd_sb16dsp_pcm(chip, 0)) < 0) { 237 if ((error = snd_sb16dsp_pcm(chip, 0)) < 0) {