Skip to content

Commit 641e969

Browse files
committed
ALSA: firewire: Fix -Wformat-truncation warning for longname string
The filling of card->longname can be gracefully truncated, as it's only informative. Use scnprintf() and suppress the superfluous compile warning with -Wformat-truncation. Link: https://lore.kernel.org/r/[email protected] Reviewed-by: Takashi Sakamoto <[email protected]> Tested-by: Takashi Sakamoto <[email protected]> Signed-off-by: Takashi Iwai <[email protected]>
1 parent 7272b8b commit 641e969

File tree

2 files changed

+10
-10
lines changed

2 files changed

+10
-10
lines changed

sound/firewire/fireworks/fireworks.c

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -93,11 +93,11 @@ get_hardware_info(struct snd_efw *efw)
9393
strcpy(efw->card->driver, "Fireworks");
9494
strcpy(efw->card->shortname, hwinfo->model_name);
9595
strcpy(efw->card->mixername, hwinfo->model_name);
96-
snprintf(efw->card->longname, sizeof(efw->card->longname),
97-
"%s %s v%s, GUID %08x%08x at %s, S%d",
98-
hwinfo->vendor_name, hwinfo->model_name, version,
99-
hwinfo->guid_hi, hwinfo->guid_lo,
100-
dev_name(&efw->unit->device), 100 << fw_dev->max_speed);
96+
scnprintf(efw->card->longname, sizeof(efw->card->longname),
97+
"%s %s v%s, GUID %08x%08x at %s, S%d",
98+
hwinfo->vendor_name, hwinfo->model_name, version,
99+
hwinfo->guid_hi, hwinfo->guid_lo,
100+
dev_name(&efw->unit->device), 100 << fw_dev->max_speed);
101101

102102
if (hwinfo->flags & BIT(FLAG_RESP_ADDR_CHANGABLE))
103103
efw->resp_addr_changable = true;

sound/firewire/oxfw/oxfw.c

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -108,11 +108,11 @@ static int name_card(struct snd_oxfw *oxfw, const struct ieee1394_device_id *ent
108108
strcpy(oxfw->card->mixername, m);
109109
strcpy(oxfw->card->shortname, m);
110110

111-
snprintf(oxfw->card->longname, sizeof(oxfw->card->longname),
112-
"%s %s (OXFW%x %04x), GUID %08x%08x at %s, S%d",
113-
v, m, firmware >> 20, firmware & 0xffff,
114-
fw_dev->config_rom[3], fw_dev->config_rom[4],
115-
dev_name(&oxfw->unit->device), 100 << fw_dev->max_speed);
111+
scnprintf(oxfw->card->longname, sizeof(oxfw->card->longname),
112+
"%s %s (OXFW%x %04x), GUID %08x%08x at %s, S%d",
113+
v, m, firmware >> 20, firmware & 0xffff,
114+
fw_dev->config_rom[3], fw_dev->config_rom[4],
115+
dev_name(&oxfw->unit->device), 100 << fw_dev->max_speed);
116116
end:
117117
return err;
118118
}

0 commit comments

Comments
 (0)