summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDan Carpenter <dan.carpenter@oracle.com>2021-06-22 22:02:02 +0300
committerTakashi Iwai <tiwai@suse.de>2021-06-22 22:33:24 +0300
commit0f7c956533680d5c905d256044d7b23f180dc230 (patch)
treeea3433099990b84ef20e909b9f8ef44bf02993a8
parent8c13212443230d03ff25014514ec0d53498c0912 (diff)
downloadlinux-0f7c956533680d5c905d256044d7b23f180dc230.tar.xz
ALSA: hdsp: fix a test for copy_to_user() failure
The copy_to_user() function returns the number of bytes remaining to be copied. It doesn't return negatives. Fixes: 66c8f75919dd ("ALSA: hdsp: Fix assignment in if condition") Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com> Link: https://lore.kernel.org/r/YNIzqpVR6L2t/RwJ@mwanda Signed-off-by: Takashi Iwai <tiwai@suse.de>
-rw-r--r--sound/pci/rme9652/hdsp.c5
1 files changed, 2 insertions, 3 deletions
diff --git a/sound/pci/rme9652/hdsp.c b/sound/pci/rme9652/hdsp.c
index e3e4fabf4abf..8457a4bbc3df 100644
--- a/sound/pci/rme9652/hdsp.c
+++ b/sound/pci/rme9652/hdsp.c
@@ -4877,9 +4877,8 @@ static int snd_hdsp_hwdep_ioctl(struct snd_hwdep *hw, struct file *file, unsigne
memset(&hdsp_version, 0, sizeof(hdsp_version));
hdsp_version.io_type = hdsp->io_type;
hdsp_version.firmware_rev = hdsp->firmware_rev;
- err = copy_to_user(argp, &hdsp_version, sizeof(hdsp_version));
- if (err < 0)
- return -EFAULT;
+ if (copy_to_user(argp, &hdsp_version, sizeof(hdsp_version)))
+ return -EFAULT;
break;
}
case SNDRV_HDSP_IOCTL_UPLOAD_FIRMWARE: {