mirror of
git://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
synced 2025-09-18 22:14:16 +00:00
ALSA: firewire: dice: Use safer strscpy() instead of strcpy()
Use a safer function strscpy() instead of strcpy() for copying to arrays. Only idiomatic code replacement, and no functional changes. Signed-off-by: Takashi Iwai <tiwai@suse.de> Reviewed-by: Takashi Sakamoto <o-takashi@sakamocchi.jp> Link: https://patch.msgid.link/20250710100727.22653-15-tiwai@suse.de
This commit is contained in:
parent
f9f63cb6eb
commit
ae2cdfc616
3 changed files with 7 additions and 7 deletions
|
@ -179,7 +179,7 @@ int snd_dice_create_hwdep(struct snd_dice *dice)
|
|||
err = snd_hwdep_new(dice->card, "DICE", 0, &hwdep);
|
||||
if (err < 0)
|
||||
return err;
|
||||
strcpy(hwdep->name, "DICE");
|
||||
strscpy(hwdep->name, "DICE");
|
||||
hwdep->iface = SNDRV_HWDEP_IFACE_FW_DICE;
|
||||
hwdep->ops = ops;
|
||||
hwdep->private_data = dice;
|
||||
|
|
|
@ -442,7 +442,7 @@ int snd_dice_create_pcm(struct snd_dice *dice)
|
|||
return err;
|
||||
pcm->private_data = dice;
|
||||
pcm->nonatomic = true;
|
||||
strcpy(pcm->name, dice->card->shortname);
|
||||
strscpy(pcm->name, dice->card->shortname);
|
||||
|
||||
if (capture > 0)
|
||||
snd_pcm_set_ops(pcm, SNDRV_PCM_STREAM_CAPTURE,
|
||||
|
|
|
@ -102,9 +102,9 @@ static void dice_card_strings(struct snd_dice *dice)
|
|||
unsigned int i;
|
||||
int err;
|
||||
|
||||
strcpy(card->driver, "DICE");
|
||||
strscpy(card->driver, "DICE");
|
||||
|
||||
strcpy(card->shortname, "DICE");
|
||||
strscpy(card->shortname, "DICE");
|
||||
BUILD_BUG_ON(NICK_NAME_SIZE < sizeof(card->shortname));
|
||||
err = snd_dice_transaction_read_global(dice, GLOBAL_NICK_NAME,
|
||||
card->shortname,
|
||||
|
@ -117,16 +117,16 @@ static void dice_card_strings(struct snd_dice *dice)
|
|||
card->shortname[sizeof(card->shortname) - 1] = '\0';
|
||||
}
|
||||
|
||||
strcpy(vendor, "?");
|
||||
strscpy(vendor, "?");
|
||||
fw_csr_string(dev->config_rom + 5, CSR_VENDOR, vendor, sizeof(vendor));
|
||||
strcpy(model, "?");
|
||||
strscpy(model, "?");
|
||||
fw_csr_string(dice->unit->directory, CSR_MODEL, model, sizeof(model));
|
||||
snprintf(card->longname, sizeof(card->longname),
|
||||
"%s %s (serial %u) at %s, S%d",
|
||||
vendor, model, dev->config_rom[4] & 0x3fffff,
|
||||
dev_name(&dice->unit->device), 100 << dev->max_speed);
|
||||
|
||||
strcpy(card->mixername, "DICE");
|
||||
strscpy(card->mixername, "DICE");
|
||||
}
|
||||
|
||||
static void dice_card_free(struct snd_card *card)
|
||||
|
|
Loading…
Add table
Reference in a new issue