diff options
| author | Pedro Demarchi Gomes <pedrodemargomes@gmail.com> | 2025-10-07 09:00:57 -0300 |
|---|---|---|
| committer | Takashi Iwai <tiwai@suse.de> | 2025-10-07 14:14:32 +0200 |
| commit | f4ace70faa8ff2890774bac86762e036a3651066 (patch) | |
| tree | ef8382f635e12f45d7a969975959d3c0221502bf | |
| parent | 7ddb711b6e0d33e0a673b49f69dff0d950ed60b9 (diff) | |
ALSA: usb: fpc: replace kmalloc_array followed by copy_from_user with memdup_array_user
Replace kmalloc_array() followed by copy_from_user() with
memdup_array_user() to improve and simplify fcp_ioctl_set_meter_map().
No functional changes intended.
Signed-off-by: Pedro Demarchi Gomes <pedrodemargomes@gmail.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
| -rw-r--r-- | sound/usb/fcp.c | 9 |
1 files changed, 3 insertions, 6 deletions
diff --git a/sound/usb/fcp.c b/sound/usb/fcp.c index 5ee8d8b66058..11e9a96b46ff 100644 --- a/sound/usb/fcp.c +++ b/sound/usb/fcp.c @@ -641,12 +641,9 @@ static int fcp_ioctl_set_meter_map(struct usb_mixer_interface *mixer, return -EINVAL; /* Allocate and copy the map data */ - tmp_map = kmalloc_array(map.map_size, sizeof(s16), GFP_KERNEL); - if (!tmp_map) - return -ENOMEM; - - if (copy_from_user(tmp_map, arg->map, map.map_size * sizeof(s16))) - return -EFAULT; + tmp_map = memdup_array_user(arg->map, map.map_size, sizeof(s16)); + if (IS_ERR(tmp_map)) + return PTR_ERR(tmp_map); err = validate_meter_map(tmp_map, map.map_size, map.meter_slots); if (err < 0) |
