Skip to content
Snippets Groups Projects
Commit 58294927 authored by Dan Carpenter's avatar Dan Carpenter Committed by Dan Williams
Browse files

cxl/mem: Return -EFAULT if copy_to_user() fails


The copy_to_user() function returns the number of bytes remaining to be
copied, but we want to return -EFAULT if the copy doesn't complete.

Fixes: b754ffbbc0ee ("cxl/mem: Add basic IOCTL interface")
Signed-off-by: default avatarDan Carpenter <dan.carpenter@oracle.com>
Link: https://lore.kernel.org/r/YC+K3kgzqm20zCWY@mwanda


Signed-off-by: default avatarDan Williams <dan.j.williams@intel.com>
parent 68a5a9a2
No related branches found
No related tags found
No related merge requests found
......@@ -752,7 +752,10 @@ static int cxl_send_cmd(struct cxl_memdev *cxlmd,
if (rc)
return rc;
return copy_to_user(s, &send, sizeof(send));
if (copy_to_user(s, &send, sizeof(send)))
return -EFAULT;
return 0;
}
static long __cxl_memdev_ioctl(struct cxl_memdev *cxlmd, unsigned int cmd,
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment