mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
synced 2025-12-27 13:30:45 -05:00
ALSA: cs46xx: 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> Link: https://patch.msgid.link/20250710100727.22653-57-tiwai@suse.de
This commit is contained in:
@@ -107,8 +107,8 @@ static int snd_card_cs46xx_probe(struct pci_dev *pci,
|
||||
|
||||
snd_cs46xx_gameport(chip);
|
||||
|
||||
strcpy(card->driver, "CS46xx");
|
||||
strcpy(card->shortname, "Sound Fusion CS46xx");
|
||||
strscpy(card->driver, "CS46xx");
|
||||
strscpy(card->shortname, "Sound Fusion CS46xx");
|
||||
sprintf(card->longname, "%s at 0x%lx/0x%lx, irq %i",
|
||||
card->shortname,
|
||||
chip->ba0_addr,
|
||||
|
||||
@@ -1760,7 +1760,7 @@ int snd_cs46xx_pcm(struct snd_cs46xx *chip, int device)
|
||||
|
||||
/* global setup */
|
||||
pcm->info_flags = 0;
|
||||
strcpy(pcm->name, "CS46xx");
|
||||
strscpy(pcm->name, "CS46xx");
|
||||
chip->pcm = pcm;
|
||||
|
||||
snd_pcm_lib_preallocate_pages_for_all(pcm, SNDRV_DMA_TYPE_DEV,
|
||||
@@ -1787,7 +1787,7 @@ int snd_cs46xx_pcm_rear(struct snd_cs46xx *chip, int device)
|
||||
|
||||
/* global setup */
|
||||
pcm->info_flags = 0;
|
||||
strcpy(pcm->name, "CS46xx - Rear");
|
||||
strscpy(pcm->name, "CS46xx - Rear");
|
||||
chip->pcm_rear = pcm;
|
||||
|
||||
snd_pcm_lib_preallocate_pages_for_all(pcm, SNDRV_DMA_TYPE_DEV,
|
||||
@@ -1812,7 +1812,7 @@ int snd_cs46xx_pcm_center_lfe(struct snd_cs46xx *chip, int device)
|
||||
|
||||
/* global setup */
|
||||
pcm->info_flags = 0;
|
||||
strcpy(pcm->name, "CS46xx - Center LFE");
|
||||
strscpy(pcm->name, "CS46xx - Center LFE");
|
||||
chip->pcm_center_lfe = pcm;
|
||||
|
||||
snd_pcm_lib_preallocate_pages_for_all(pcm, SNDRV_DMA_TYPE_DEV,
|
||||
@@ -1837,7 +1837,7 @@ int snd_cs46xx_pcm_iec958(struct snd_cs46xx *chip, int device)
|
||||
|
||||
/* global setup */
|
||||
pcm->info_flags = 0;
|
||||
strcpy(pcm->name, "CS46xx - IEC958");
|
||||
strscpy(pcm->name, "CS46xx - IEC958");
|
||||
chip->pcm_iec958 = pcm;
|
||||
|
||||
snd_pcm_lib_preallocate_pages_for_all(pcm, SNDRV_DMA_TYPE_DEV,
|
||||
@@ -2672,7 +2672,7 @@ int snd_cs46xx_midi(struct snd_cs46xx *chip, int device)
|
||||
err = snd_rawmidi_new(chip->card, "CS46XX", device, 1, 1, &rmidi);
|
||||
if (err < 0)
|
||||
return err;
|
||||
strcpy(rmidi->name, "CS46XX");
|
||||
strscpy(rmidi->name, "CS46XX");
|
||||
snd_rawmidi_set_ops(rmidi, SNDRV_RAWMIDI_STREAM_OUTPUT, &snd_cs46xx_midi_output);
|
||||
snd_rawmidi_set_ops(rmidi, SNDRV_RAWMIDI_STREAM_INPUT, &snd_cs46xx_midi_input);
|
||||
rmidi->info_flags |= SNDRV_RAWMIDI_INFO_OUTPUT | SNDRV_RAWMIDI_INFO_INPUT | SNDRV_RAWMIDI_INFO_DUPLEX;
|
||||
@@ -3853,27 +3853,27 @@ int snd_cs46xx_create(struct snd_card *card,
|
||||
}
|
||||
|
||||
region = &chip->region.name.ba0;
|
||||
strcpy(region->name, "CS46xx_BA0");
|
||||
strscpy(region->name, "CS46xx_BA0");
|
||||
region->base = chip->ba0_addr;
|
||||
region->size = CS46XX_BA0_SIZE;
|
||||
|
||||
region = &chip->region.name.data0;
|
||||
strcpy(region->name, "CS46xx_BA1_data0");
|
||||
strscpy(region->name, "CS46xx_BA1_data0");
|
||||
region->base = chip->ba1_addr + BA1_SP_DMEM0;
|
||||
region->size = CS46XX_BA1_DATA0_SIZE;
|
||||
|
||||
region = &chip->region.name.data1;
|
||||
strcpy(region->name, "CS46xx_BA1_data1");
|
||||
strscpy(region->name, "CS46xx_BA1_data1");
|
||||
region->base = chip->ba1_addr + BA1_SP_DMEM1;
|
||||
region->size = CS46XX_BA1_DATA1_SIZE;
|
||||
|
||||
region = &chip->region.name.pmem;
|
||||
strcpy(region->name, "CS46xx_BA1_pmem");
|
||||
strscpy(region->name, "CS46xx_BA1_pmem");
|
||||
region->base = chip->ba1_addr + BA1_SP_PMEM;
|
||||
region->size = CS46XX_BA1_PRG_SIZE;
|
||||
|
||||
region = &chip->region.name.reg;
|
||||
strcpy(region->name, "CS46xx_BA1_reg");
|
||||
strscpy(region->name, "CS46xx_BA1_reg");
|
||||
region->base = chip->ba1_addr + BA1_SP_REG;
|
||||
region->size = CS46XX_BA1_REG_SIZE;
|
||||
|
||||
|
||||
@@ -203,7 +203,7 @@ add_symbol (struct snd_cs46xx * chip, char * symbol_name, u32 address, int type)
|
||||
|
||||
index = find_free_symbol_index (ins);
|
||||
|
||||
strcpy (ins->symbol_table.symbols[index].symbol_name, symbol_name);
|
||||
strscpy (ins->symbol_table.symbols[index].symbol_name, symbol_name);
|
||||
ins->symbol_table.symbols[index].address = address;
|
||||
ins->symbol_table.symbols[index].symbol_type = type;
|
||||
ins->symbol_table.symbols[index].module = NULL;
|
||||
@@ -923,7 +923,7 @@ static struct dsp_scb_descriptor * _map_scb (struct snd_cs46xx *chip, char * nam
|
||||
index = find_free_scb_index (ins);
|
||||
|
||||
memset(&ins->scbs[index], 0, sizeof(ins->scbs[index]));
|
||||
strcpy(ins->scbs[index].scb_name, name);
|
||||
strscpy(ins->scbs[index].scb_name, name);
|
||||
ins->scbs[index].address = dest;
|
||||
ins->scbs[index].index = index;
|
||||
ins->scbs[index].ref_count = 1;
|
||||
@@ -953,9 +953,9 @@ _map_task_tree (struct snd_cs46xx *chip, char * name, u32 dest, u32 size)
|
||||
}
|
||||
|
||||
if (name)
|
||||
strcpy(ins->tasks[ins->ntask].task_name, name);
|
||||
strscpy(ins->tasks[ins->ntask].task_name, name);
|
||||
else
|
||||
strcpy(ins->tasks[ins->ntask].task_name, "(NULL)");
|
||||
strscpy(ins->tasks[ins->ntask].task_name, "(NULL)");
|
||||
ins->tasks[ins->ntask].address = dest;
|
||||
ins->tasks[ins->ntask].size = size;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user