提交 0f7c9565 编写于 作者: D Dan Carpenter 提交者: Takashi Iwai

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: 66c8f759 ("ALSA: hdsp: Fix assignment in if condition")
Signed-off-by: NDan Carpenter <dan.carpenter@oracle.com>
Link: https://lore.kernel.org/r/YNIzqpVR6L2t/RwJ@mwandaSigned-off-by: NTakashi Iwai <tiwai@suse.de>
上级 8c132124
......@@ -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: {
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册