Commit 0f7c9565 authored by Dan Carpenter's avatar Dan Carpenter Committed by Takashi Iwai
Browse files

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: default avatarDan Carpenter <dan.carpenter@oracle.com>
Link: https://lore.kernel.org/r/YNIzqpVR6L2t/RwJ@mwanda


Signed-off-by: default avatarTakashi Iwai <tiwai@suse.de>
parent 8c132124
Loading
Loading
Loading
Loading
+2 −3
Original line number Diff line number Diff line
@@ -4877,8 +4877,7 @@ 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)
		if (copy_to_user(argp, &hdsp_version, sizeof(hdsp_version)))
			return -EFAULT;
		break;
	}