Commit 87b554a0 authored by Dan Carpenter's avatar Dan Carpenter Committed by Greg Kroah-Hartman

Staging: intel_sst: return -EFAULT if copy_to_user() fails

copy_to_user() returns the number of bytes remaining to be copied but we
want to return an error code.  And that error code is -EFAULT not -EIO.
Signed-off-by: default avatarDan Carpenter <error27@gmail.com>
Acked-by: default avatarAlan Cox <alan@linux.intel.com>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@suse.de>
parent e98cb276
......@@ -861,6 +861,8 @@ long intel_sst_ioctl(struct file *file_ptr, unsigned int cmd, unsigned long arg)
str_info->src = SST_DRV;
retval = copy_to_user(&str_param->stream_id,
&retval, sizeof(__u32));
if (retval)
retval = -EFAULT;
} else {
if (retval == -SST_ERR_INVALID_PARAMS)
retval = -EINVAL;
......@@ -934,7 +936,7 @@ long intel_sst_ioctl(struct file *file_ptr, unsigned int cmd, unsigned long arg)
retval = copy_to_user((struct snd_sst_vol *)arg,
&get_vol, sizeof(get_vol));
if (retval) {
retval = -EIO;
retval = -EFAULT;
break;
}
/*sst_print_get_vol_info(str_id, &get_vol);*/
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment