Skip to content

Commit

Permalink
ALSA: Convert strlcpy to strscpy when return value is unused
Browse files Browse the repository at this point in the history
strlcpy is deprecated.  see: Documentation/process/deprecated.rst

Change the calls that do not use the strlcpy return value to the
preferred strscpy.

Done with cocci script:

@@
expression e1, e2, e3;
@@

-	strlcpy(
+	strscpy(
	e1, e2, e3);

This cocci script leaves the instances where the return value is
used unchanged.

After this patch, sound/ has 3 uses of strlcpy() that need to be
manually inspected for conversion and changed one day.

$ git grep -w strlcpy sound/
sound/usb/card.c:               len = strlcpy(card->longname, s, sizeof(card->longname));
sound/usb/mixer.c:      return strlcpy(buf, p->name, buflen);
sound/usb/mixer.c:                      return strlcpy(buf, p->names[index], buflen);

Miscellenea:

o Remove trailing whitespace in conversion of sound/core/hwdep.c

Link: https://lore.kernel.org/lkml/CAHk-=wgfRnXz0W3D37d01q3JFkr_i_uTL=V6A6G1oUZcprmknw@mail.gmail.com/

Signed-off-by: Joe Perches <[email protected]>
Acked-by: Mark Brown <[email protected]>
Link: https://lore.kernel.org/r/[email protected]
Signed-off-by: Takashi Iwai <[email protected]>
  • Loading branch information
JoePerches authored and tiwai committed Jan 8, 2021
1 parent 6dcb8bf commit 75b1a8f
Show file tree
Hide file tree
Showing 79 changed files with 134 additions and 134 deletions.
2 changes: 1 addition & 1 deletion sound/aoa/codecs/onyx.c
Original file line number Diff line number Diff line change
Expand Up @@ -1013,7 +1013,7 @@ static int onyx_i2c_probe(struct i2c_client *client,
goto fail;
}

strlcpy(onyx->codec.name, "onyx", MAX_CODEC_NAME_LEN);
strscpy(onyx->codec.name, "onyx", MAX_CODEC_NAME_LEN);
onyx->codec.owner = THIS_MODULE;
onyx->codec.init = onyx_init_codec;
onyx->codec.exit = onyx_exit_codec;
Expand Down
2 changes: 1 addition & 1 deletion sound/aoa/codecs/tas.c
Original file line number Diff line number Diff line change
Expand Up @@ -894,7 +894,7 @@ static int tas_i2c_probe(struct i2c_client *client,
/* seems that half is a saner default */
tas->drc_range = TAS3004_DRC_MAX / 2;

strlcpy(tas->codec.name, "tas", MAX_CODEC_NAME_LEN);
strscpy(tas->codec.name, "tas", MAX_CODEC_NAME_LEN);
tas->codec.owner = THIS_MODULE;
tas->codec.init = tas_init_codec;
tas->codec.exit = tas_exit_codec;
Expand Down
2 changes: 1 addition & 1 deletion sound/aoa/codecs/toonie.c
Original file line number Diff line number Diff line change
Expand Up @@ -126,7 +126,7 @@ static int __init toonie_init(void)
if (!toonie)
return -ENOMEM;

strlcpy(toonie->codec.name, "toonie", sizeof(toonie->codec.name));
strscpy(toonie->codec.name, "toonie", sizeof(toonie->codec.name));
toonie->codec.owner = THIS_MODULE;
toonie->codec.init = toonie_init_codec;
toonie->codec.exit = toonie_exit_codec;
Expand Down
8 changes: 4 additions & 4 deletions sound/aoa/core/alsa.c
Original file line number Diff line number Diff line change
Expand Up @@ -28,10 +28,10 @@ int aoa_alsa_init(char *name, struct module *mod, struct device *dev)
return err;
aoa_card = alsa_card->private_data;
aoa_card->alsa_card = alsa_card;
strlcpy(alsa_card->driver, "AppleOnbdAudio", sizeof(alsa_card->driver));
strlcpy(alsa_card->shortname, name, sizeof(alsa_card->shortname));
strlcpy(alsa_card->longname, name, sizeof(alsa_card->longname));
strlcpy(alsa_card->mixername, name, sizeof(alsa_card->mixername));
strscpy(alsa_card->driver, "AppleOnbdAudio", sizeof(alsa_card->driver));
strscpy(alsa_card->shortname, name, sizeof(alsa_card->shortname));
strscpy(alsa_card->longname, name, sizeof(alsa_card->longname));
strscpy(alsa_card->mixername, name, sizeof(alsa_card->mixername));
err = snd_card_register(aoa_card->alsa_card);
if (err < 0) {
printk(KERN_ERR "snd-aoa: couldn't register alsa card\n");
Expand Down
6 changes: 3 additions & 3 deletions sound/aoa/fabrics/layout.c
Original file line number Diff line number Diff line change
Expand Up @@ -948,7 +948,7 @@ static void layout_attached_codec(struct aoa_codec *codec)
ldev->gpio.methods->set_lineout(codec->gpio, 1);
ctl = snd_ctl_new1(&lineout_ctl, codec->gpio);
if (cc->connected & CC_LINEOUT_LABELLED_HEADPHONE)
strlcpy(ctl->id.name,
strscpy(ctl->id.name,
"Headphone Switch", sizeof(ctl->id.name));
ldev->lineout_ctrl = ctl;
aoa_snd_ctl_add(ctl);
Expand All @@ -962,14 +962,14 @@ static void layout_attached_codec(struct aoa_codec *codec)
ctl = snd_ctl_new1(&lineout_detect_choice,
ldev);
if (cc->connected & CC_LINEOUT_LABELLED_HEADPHONE)
strlcpy(ctl->id.name,
strscpy(ctl->id.name,
"Headphone Detect Autoswitch",
sizeof(ctl->id.name));
aoa_snd_ctl_add(ctl);
ctl = snd_ctl_new1(&lineout_detected,
ldev);
if (cc->connected & CC_LINEOUT_LABELLED_HEADPHONE)
strlcpy(ctl->id.name,
strscpy(ctl->id.name,
"Headphone Detected",
sizeof(ctl->id.name));
ldev->lineout_detected_ctrl = ctl;
Expand Down
2 changes: 1 addition & 1 deletion sound/aoa/soundbus/sysfs.c
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ static ssize_t modalias_show(struct device *dev, struct device_attribute *attr,
int length;

if (*sdev->modalias) {
strlcpy(buf, sdev->modalias, sizeof(sdev->modalias) + 1);
strscpy(buf, sdev->modalias, sizeof(sdev->modalias) + 1);
strcat(buf, "\n");
length = strlen(buf);
} else {
Expand Down
6 changes: 3 additions & 3 deletions sound/arm/aaci.c
Original file line number Diff line number Diff line change
Expand Up @@ -890,8 +890,8 @@ static struct aaci *aaci_init_card(struct amba_device *dev)

card->private_free = aaci_free_card;

strlcpy(card->driver, DRIVER_NAME, sizeof(card->driver));
strlcpy(card->shortname, "ARM AC'97 Interface", sizeof(card->shortname));
strscpy(card->driver, DRIVER_NAME, sizeof(card->driver));
strscpy(card->shortname, "ARM AC'97 Interface", sizeof(card->shortname));
snprintf(card->longname, sizeof(card->longname),
"%s PL%03x rev%u at 0x%08llx, irq %d",
card->shortname, amba_part(dev), amba_rev(dev),
Expand Down Expand Up @@ -921,7 +921,7 @@ static int aaci_init_pcm(struct aaci *aaci)
pcm->private_data = aaci;
pcm->info_flags = 0;

strlcpy(pcm->name, DRIVER_NAME, sizeof(pcm->name));
strscpy(pcm->name, DRIVER_NAME, sizeof(pcm->name));

snd_pcm_set_ops(pcm, SNDRV_PCM_STREAM_PLAYBACK, &aaci_playback_ops);
snd_pcm_set_ops(pcm, SNDRV_PCM_STREAM_CAPTURE, &aaci_capture_ops);
Expand Down
2 changes: 1 addition & 1 deletion sound/arm/pxa2xx-ac97.c
Original file line number Diff line number Diff line change
Expand Up @@ -235,7 +235,7 @@ static int pxa2xx_ac97_probe(struct platform_device *dev)
if (ret < 0)
goto err;

strlcpy(card->driver, dev->dev.driver->name, sizeof(card->driver));
strscpy(card->driver, dev->dev.driver->name, sizeof(card->driver));

ret = pxa2xx_ac97_pcm_new(card);
if (ret)
Expand Down
2 changes: 1 addition & 1 deletion sound/core/compress_offload.c
Original file line number Diff line number Diff line change
Expand Up @@ -1132,7 +1132,7 @@ static void snd_compress_proc_done(struct snd_compr *compr)

static inline void snd_compress_set_id(struct snd_compr *compr, const char *id)
{
strlcpy(compr->id, id, sizeof(compr->id));
strscpy(compr->id, id, sizeof(compr->id));
}
#else
static inline int snd_compress_proc_init(struct snd_compr *compr)
Expand Down
16 changes: 8 additions & 8 deletions sound/core/control.c
Original file line number Diff line number Diff line change
Expand Up @@ -261,7 +261,7 @@ struct snd_kcontrol *snd_ctl_new1(const struct snd_kcontrol_new *ncontrol,
kctl->id.device = ncontrol->device;
kctl->id.subdevice = ncontrol->subdevice;
if (ncontrol->name) {
strlcpy(kctl->id.name, ncontrol->name, sizeof(kctl->id.name));
strscpy(kctl->id.name, ncontrol->name, sizeof(kctl->id.name));
if (strcmp(ncontrol->name, kctl->id.name) != 0)
pr_warn("ALSA: Control name '%s' truncated to '%s'\n",
ncontrol->name, kctl->id.name);
Expand Down Expand Up @@ -701,12 +701,12 @@ static int snd_ctl_card_info(struct snd_card *card, struct snd_ctl_file * ctl,
return -ENOMEM;
down_read(&snd_ioctl_rwsem);
info->card = card->number;
strlcpy(info->id, card->id, sizeof(info->id));
strlcpy(info->driver, card->driver, sizeof(info->driver));
strlcpy(info->name, card->shortname, sizeof(info->name));
strlcpy(info->longname, card->longname, sizeof(info->longname));
strlcpy(info->mixername, card->mixername, sizeof(info->mixername));
strlcpy(info->components, card->components, sizeof(info->components));
strscpy(info->id, card->id, sizeof(info->id));
strscpy(info->driver, card->driver, sizeof(info->driver));
strscpy(info->name, card->shortname, sizeof(info->name));
strscpy(info->longname, card->longname, sizeof(info->longname));
strscpy(info->mixername, card->mixername, sizeof(info->mixername));
strscpy(info->components, card->components, sizeof(info->components));
up_read(&snd_ioctl_rwsem);
if (copy_to_user(arg, info, sizeof(struct snd_ctl_card_info))) {
kfree(info);
Expand Down Expand Up @@ -2137,7 +2137,7 @@ int snd_ctl_enum_info(struct snd_ctl_elem_info *info, unsigned int channels,
WARN(strlen(names[info->value.enumerated.item]) >= sizeof(info->value.enumerated.name),
"ALSA: too long item name '%s'\n",
names[info->value.enumerated.item]);
strlcpy(info->value.enumerated.name,
strscpy(info->value.enumerated.name,
names[info->value.enumerated.item],
sizeof(info->value.enumerated.name));
return 0;
Expand Down
2 changes: 1 addition & 1 deletion sound/core/ctljack.c
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ static int get_available_index(struct snd_card *card, const char *name)

sid.index = 0;
sid.iface = SNDRV_CTL_ELEM_IFACE_CARD;
strlcpy(sid.name, name, sizeof(sid.name));
strscpy(sid.name, name, sizeof(sid.name));

while (snd_ctl_find_id(card, &sid)) {
sid.index++;
Expand Down
6 changes: 3 additions & 3 deletions sound/core/hwdep.c
Original file line number Diff line number Diff line change
Expand Up @@ -177,8 +177,8 @@ static int snd_hwdep_info(struct snd_hwdep *hw,

memset(&info, 0, sizeof(info));
info.card = hw->card->number;
strlcpy(info.id, hw->id, sizeof(info.id));
strlcpy(info.name, hw->name, sizeof(info.name));
strscpy(info.id, hw->id, sizeof(info.id));
strscpy(info.name, hw->name, sizeof(info.name));
info.iface = hw->iface;
if (copy_to_user(_info, &info, sizeof(info)))
return -EFAULT;
Expand Down Expand Up @@ -379,7 +379,7 @@ int snd_hwdep_new(struct snd_card *card, char *id, int device,
hwdep->card = card;
hwdep->device = device;
if (id)
strlcpy(hwdep->id, id, sizeof(hwdep->id));
strscpy(hwdep->id, id, sizeof(hwdep->id));

snd_device_initialize(&hwdep->dev, card);
hwdep->dev.release = release_hwdep_device;
Expand Down
4 changes: 2 additions & 2 deletions sound/core/init.c
Original file line number Diff line number Diff line change
Expand Up @@ -174,7 +174,7 @@ int snd_card_new(struct device *parent, int idx, const char *xid,
if (extra_size > 0)
card->private_data = (char *)card + sizeof(struct snd_card);
if (xid)
strlcpy(card->id, xid, sizeof(card->id));
strscpy(card->id, xid, sizeof(card->id));
err = 0;
mutex_lock(&snd_card_mutex);
if (idx < 0) /* first check the matching module-name slot */
Expand Down Expand Up @@ -623,7 +623,7 @@ static void snd_card_set_id_no_lock(struct snd_card *card, const char *src,
/* last resort... */
dev_err(card->dev, "unable to set card id (%s)\n", id);
if (card->proc_root->name)
strlcpy(card->id, card->proc_root->name, sizeof(card->id));
strscpy(card->id, card->proc_root->name, sizeof(card->id));
}

/**
Expand Down
12 changes: 6 additions & 6 deletions sound/core/oss/mixer_oss.c
Original file line number Diff line number Diff line change
Expand Up @@ -87,8 +87,8 @@ static int snd_mixer_oss_info(struct snd_mixer_oss_file *fmixer,
struct mixer_info info;

memset(&info, 0, sizeof(info));
strlcpy(info.id, mixer && mixer->id[0] ? mixer->id : card->driver, sizeof(info.id));
strlcpy(info.name, mixer && mixer->name[0] ? mixer->name : card->mixername, sizeof(info.name));
strscpy(info.id, mixer && mixer->id[0] ? mixer->id : card->driver, sizeof(info.id));
strscpy(info.name, mixer && mixer->name[0] ? mixer->name : card->mixername, sizeof(info.name));
info.modify_counter = card->mixer_oss_change_count;
if (copy_to_user(_info, &info, sizeof(info)))
return -EFAULT;
Expand All @@ -103,8 +103,8 @@ static int snd_mixer_oss_info_obsolete(struct snd_mixer_oss_file *fmixer,
_old_mixer_info info;

memset(&info, 0, sizeof(info));
strlcpy(info.id, mixer && mixer->id[0] ? mixer->id : card->driver, sizeof(info.id));
strlcpy(info.name, mixer && mixer->name[0] ? mixer->name : card->mixername, sizeof(info.name));
strscpy(info.id, mixer && mixer->id[0] ? mixer->id : card->driver, sizeof(info.id));
strscpy(info.name, mixer && mixer->name[0] ? mixer->name : card->mixername, sizeof(info.name));
if (copy_to_user(_info, &info, sizeof(info)))
return -EFAULT;
return 0;
Expand Down Expand Up @@ -499,7 +499,7 @@ static struct snd_kcontrol *snd_mixer_oss_test_id(struct snd_mixer_oss *mixer, c

memset(&id, 0, sizeof(id));
id.iface = SNDRV_CTL_ELEM_IFACE_MIXER;
strlcpy(id.name, name, sizeof(id.name));
strscpy(id.name, name, sizeof(id.name));
id.index = index;
return snd_ctl_find_id(card, &id);
}
Expand Down Expand Up @@ -1355,7 +1355,7 @@ static int snd_mixer_oss_notify_handler(struct snd_card *card, int cmd)
mixer->oss_dev_alloc = 1;
mixer->card = card;
if (*card->mixername)
strlcpy(mixer->name, card->mixername, sizeof(mixer->name));
strscpy(mixer->name, card->mixername, sizeof(mixer->name));
else
snprintf(mixer->name, sizeof(mixer->name),
"mixer%i", card->number);
Expand Down
2 changes: 1 addition & 1 deletion sound/core/pcm.c
Original file line number Diff line number Diff line change
Expand Up @@ -729,7 +729,7 @@ static int _snd_pcm_new(struct snd_card *card, const char *id, int device,
init_waitqueue_head(&pcm->open_wait);
INIT_LIST_HEAD(&pcm->list);
if (id)
strlcpy(pcm->id, id, sizeof(pcm->id));
strscpy(pcm->id, id, sizeof(pcm->id));

err = snd_pcm_new_stream(pcm, SNDRV_PCM_STREAM_PLAYBACK,
playback_count);
Expand Down
6 changes: 3 additions & 3 deletions sound/core/pcm_native.c
Original file line number Diff line number Diff line change
Expand Up @@ -209,13 +209,13 @@ int snd_pcm_info(struct snd_pcm_substream *substream, struct snd_pcm_info *info)
info->device = pcm->device;
info->stream = substream->stream;
info->subdevice = substream->number;
strlcpy(info->id, pcm->id, sizeof(info->id));
strlcpy(info->name, pcm->name, sizeof(info->name));
strscpy(info->id, pcm->id, sizeof(info->id));
strscpy(info->name, pcm->name, sizeof(info->name));
info->dev_class = pcm->dev_class;
info->dev_subclass = pcm->dev_subclass;
info->subdevices_count = pstr->substream_count;
info->subdevices_avail = pstr->substream_count - pstr->substream_opened;
strlcpy(info->subname, substream->name, sizeof(info->subname));
strscpy(info->subname, substream->name, sizeof(info->subname));

return 0;
}
Expand Down
2 changes: 1 addition & 1 deletion sound/core/rawmidi.c
Original file line number Diff line number Diff line change
Expand Up @@ -1686,7 +1686,7 @@ int snd_rawmidi_new(struct snd_card *card, char *id, int device,
INIT_LIST_HEAD(&rmidi->streams[SNDRV_RAWMIDI_STREAM_OUTPUT].substreams);

if (id != NULL)
strlcpy(rmidi->id, id, sizeof(rmidi->id));
strscpy(rmidi->id, id, sizeof(rmidi->id));

snd_device_initialize(&rmidi->dev, card);
rmidi->dev.release = release_rawmidi_device;
Expand Down
4 changes: 2 additions & 2 deletions sound/core/seq/oss/seq_oss_midi.c
Original file line number Diff line number Diff line change
Expand Up @@ -173,7 +173,7 @@ snd_seq_oss_midi_check_new_port(struct snd_seq_port_info *pinfo)
snd_use_lock_init(&mdev->use_lock);

/* copy and truncate the name of synth device */
strlcpy(mdev->name, pinfo->name, sizeof(mdev->name));
strscpy(mdev->name, pinfo->name, sizeof(mdev->name));

/* create MIDI coder */
if (snd_midi_event_new(MAX_MIDI_EVENT_BUF, &mdev->coder) < 0) {
Expand Down Expand Up @@ -647,7 +647,7 @@ snd_seq_oss_midi_make_info(struct seq_oss_devinfo *dp, int dev, struct midi_info
inf->device = dev;
inf->dev_type = 0; /* FIXME: ?? */
inf->capabilities = 0; /* FIXME: ?? */
strlcpy(inf->name, mdev->name, sizeof(inf->name));
strscpy(inf->name, mdev->name, sizeof(inf->name));
snd_use_lock_free(&mdev->use_lock);
return 0;
}
Expand Down
6 changes: 3 additions & 3 deletions sound/core/seq/oss/seq_oss_synth.c
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,7 @@ snd_seq_oss_synth_probe(struct device *_dev)
snd_use_lock_init(&rec->use_lock);

/* copy and truncate the name of synth device */
strlcpy(rec->name, dev->name, sizeof(rec->name));
strscpy(rec->name, dev->name, sizeof(rec->name));

/* registration */
spin_lock_irqsave(&register_lock, flags);
Expand Down Expand Up @@ -616,15 +616,15 @@ snd_seq_oss_synth_make_info(struct seq_oss_devinfo *dp, int dev, struct synth_in
inf->synth_subtype = 0;
inf->nr_voices = 16;
inf->device = dev;
strlcpy(inf->name, minf.name, sizeof(inf->name));
strscpy(inf->name, minf.name, sizeof(inf->name));
} else {
if ((rec = get_synthdev(dp, dev)) == NULL)
return -ENXIO;
inf->synth_type = rec->synth_type;
inf->synth_subtype = rec->synth_subtype;
inf->nr_voices = rec->nr_voices;
inf->device = dev;
strlcpy(inf->name, rec->name, sizeof(inf->name));
strscpy(inf->name, rec->name, sizeof(inf->name));
snd_use_lock_free(&rec->use_lock);
}
return 0;
Expand Down
2 changes: 1 addition & 1 deletion sound/core/seq/seq_clientmgr.c
Original file line number Diff line number Diff line change
Expand Up @@ -1584,7 +1584,7 @@ static int snd_seq_ioctl_get_queue_info(struct snd_seq_client *client,
info->queue = q->queue;
info->owner = q->owner;
info->locked = q->locked;
strlcpy(info->name, q->name, sizeof(info->name));
strscpy(info->name, q->name, sizeof(info->name));
queuefree(q);

return 0;
Expand Down
6 changes: 3 additions & 3 deletions sound/core/seq/seq_ports.c
Original file line number Diff line number Diff line change
Expand Up @@ -327,7 +327,7 @@ int snd_seq_set_port_info(struct snd_seq_client_port * port,

/* set port name */
if (info->name[0])
strlcpy(port->name, info->name, sizeof(port->name));
strscpy(port->name, info->name, sizeof(port->name));

/* set capabilities */
port->capability = info->capability;
Expand Down Expand Up @@ -356,7 +356,7 @@ int snd_seq_get_port_info(struct snd_seq_client_port * port,
return -EINVAL;

/* get port name */
strlcpy(info->name, port->name, sizeof(info->name));
strscpy(info->name, port->name, sizeof(info->name));

/* get capabilities */
info->capability = port->capability;
Expand Down Expand Up @@ -654,7 +654,7 @@ int snd_seq_event_port_attach(int client,
/* Set up the port */
memset(&portinfo, 0, sizeof(portinfo));
portinfo.addr.client = client;
strlcpy(portinfo.name, portname ? portname : "Unnamed port",
strscpy(portinfo.name, portname ? portname : "Unnamed port",
sizeof(portinfo.name));

portinfo.capability = cap;
Expand Down
10 changes: 5 additions & 5 deletions sound/core/timer.c
Original file line number Diff line number Diff line change
Expand Up @@ -959,7 +959,7 @@ int snd_timer_new(struct snd_card *card, char *id, struct snd_timer_id *tid,
timer->tmr_device = tid->device;
timer->tmr_subdevice = tid->subdevice;
if (id)
strlcpy(timer->id, id, sizeof(timer->id));
strscpy(timer->id, id, sizeof(timer->id));
timer->sticks = 1;
INIT_LIST_HEAD(&timer->device_list);
INIT_LIST_HEAD(&timer->open_list_head);
Expand Down Expand Up @@ -1659,8 +1659,8 @@ static int snd_timer_user_ginfo(struct file *file,
ginfo->card = t->card ? t->card->number : -1;
if (t->hw.flags & SNDRV_TIMER_HW_SLAVE)
ginfo->flags |= SNDRV_TIMER_FLG_SLAVE;
strlcpy(ginfo->id, t->id, sizeof(ginfo->id));
strlcpy(ginfo->name, t->name, sizeof(ginfo->name));
strscpy(ginfo->id, t->id, sizeof(ginfo->id));
strscpy(ginfo->name, t->name, sizeof(ginfo->name));
ginfo->resolution = t->hw.resolution;
if (t->hw.resolution_min > 0) {
ginfo->resolution_min = t->hw.resolution_min;
Expand Down Expand Up @@ -1814,8 +1814,8 @@ static int snd_timer_user_info(struct file *file,
info->card = t->card ? t->card->number : -1;
if (t->hw.flags & SNDRV_TIMER_HW_SLAVE)
info->flags |= SNDRV_TIMER_FLG_SLAVE;
strlcpy(info->id, t->id, sizeof(info->id));
strlcpy(info->name, t->name, sizeof(info->name));
strscpy(info->id, t->id, sizeof(info->id));
strscpy(info->name, t->name, sizeof(info->name));
info->resolution = t->hw.resolution;
if (copy_to_user(_info, info, sizeof(*_info)))
err = -EFAULT;
Expand Down
4 changes: 2 additions & 2 deletions sound/core/timer_compat.c
Original file line number Diff line number Diff line change
Expand Up @@ -61,8 +61,8 @@ static int snd_timer_user_info_compat(struct file *file,
info.card = t->card ? t->card->number : -1;
if (t->hw.flags & SNDRV_TIMER_HW_SLAVE)
info.flags |= SNDRV_TIMER_FLG_SLAVE;
strlcpy(info.id, t->id, sizeof(info.id));
strlcpy(info.name, t->name, sizeof(info.name));
strscpy(info.id, t->id, sizeof(info.id));
strscpy(info.name, t->name, sizeof(info.name));
info.resolution = t->hw.resolution;
if (copy_to_user(_info, &info, sizeof(*_info)))
return -EFAULT;
Expand Down
Loading

0 comments on commit 75b1a8f

Please sign in to comment.