summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDan Carpenter <dan.carpenter@oracle.com>2015-12-24 10:24:37 +0300
committerRafael J. Wysocki <rafael.j.wysocki@intel.com>2015-12-28 01:29:41 +0100
commitec74765d9f592715292b8b33689a6af6db4cf5c5 (patch)
tree514b5f24b696674c1d2d4d1ef540a4158fc70042
parent436db5ce0d0e892d2f7327dd7ffd573c5fb9e6cb (diff)
ACPI / debugger: copy_to_user doesn't return errors
The copy_to/from_user() functions don't return error codes, they return the number of bytes remaining. We had intended to return -EFUALT here. We actually have already checked access_ok() in an earlier function so I don't think these functions will fail but let's fix it anyway. Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com> Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
-rw-r--r--drivers/acpi/acpi_dbg.c10
1 files changed, 6 insertions, 4 deletions
diff --git a/drivers/acpi/acpi_dbg.c b/drivers/acpi/acpi_dbg.c
index 975ccecf6215..e8d1698c15bb 100644
--- a/drivers/acpi/acpi_dbg.c
+++ b/drivers/acpi/acpi_dbg.c
@@ -592,9 +592,10 @@ static int acpi_aml_read_user(char __user *buf, int len)
smp_rmb();
p = &crc->buf[crc->tail];
n = min(len, circ_count_to_end(crc));
- ret = copy_to_user(buf, p, n);
- if (IS_ERR_VALUE(ret))
+ if (copy_to_user(buf, p, n)) {
+ ret = -EFAULT;
goto out;
+ }
/* sync tail after removing logs */
smp_mb();
crc->tail = (crc->tail + n) & (ACPI_AML_BUF_SIZE - 1);
@@ -661,9 +662,10 @@ static int acpi_aml_write_user(const char __user *buf, int len)
smp_mb();
p = &crc->buf[crc->head];
n = min(len, circ_space_to_end(crc));
- ret = copy_from_user(p, buf, n);
- if (IS_ERR_VALUE(ret))
+ if (copy_from_user(p, buf, n)) {
+ ret = -EFAULT;
goto out;
+ }
/* sync head after inserting cmds */
smp_wmb();
crc->head = (crc->head + n) & (ACPI_AML_BUF_SIZE - 1);