[patch 1/2] Staging: intel_sst: return -EFAULT if copy_to_user() fails

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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: Dan Carpenter <error27@xxxxxxxxx>

diff --git a/drivers/staging/intel_sst/intel_sst_app_interface.c b/drivers/staging/intel_sst/intel_sst_app_interface.c
index baf0ddc..5ead4d1 100644
--- a/drivers/staging/intel_sst/intel_sst_app_interface.c
+++ b/drivers/staging/intel_sst/intel_sst_app_interface.c
@@ -865,6 +865,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;
@@ -938,7 +940,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);*/
--
To unsubscribe from this list: send the line "unsubscribe kernel-janitors" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[Index of Archives]     [Kernel Development]     [Kernel Announce]     [Kernel Newbies]     [Linux Networking Development]     [Share Photos]     [IDE]     [Security]     [Git]     [Netfilter]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Device Mapper]

  Powered by Linux