Commit 7759ec82 authored by Jody McIntyre's avatar Jody McIntyre

This patch makes sure we check the return value of copy_to_user() in

drivers/ieee1394/raw1394.c::raw1394_read() with the added bonus of
silencing this warning:
include/asm/uaccess.h: In function `raw1394_read':
drivers/ieee1394/raw1394.c:446: warning: ignoring return value of `__copy_to_user', declared with attribute warn_unused_result

I've submitted this before, but never got an ACK or NACK, and the patch is
still relevant against latest Linus bk (2.6.10-rc2-bk11 atm).
Signed-off-by: default avatarJesper Juhl <juhl-lkml@dif.dk>
Signed-off-by: default avatarJody McIntyre <scjody@modernduck.com>
parent 0f190ca5
......@@ -411,6 +411,7 @@ static ssize_t raw1394_read(struct file *file, char __user *buffer, size_t count
struct file_info *fi = (struct file_info *)file->private_data;
struct list_head *lh;
struct pending_request *req;
ssize_t ret;
if (count != sizeof(struct raw1394_request)) {
return -EINVAL;
......@@ -443,10 +444,15 @@ static ssize_t raw1394_read(struct file *file, char __user *buffer, size_t count
req->req.error = RAW1394_ERROR_MEMFAULT;
}
}
__copy_to_user(buffer, &req->req, sizeof(req->req));
if (copy_to_user(buffer, &req->req, sizeof(req->req))) {
ret = -EFAULT;
goto out;
}
ret = (ssize_t)sizeof(struct raw1394_request);
out:
free_pending_request(req);
return sizeof(struct raw1394_request);
return ret;
}
......
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