Commit e068527c authored by Andrew Morton's avatar Andrew Morton Committed by Linus Torvalds

[PATCH] eicon usercopy fix

From: Dipankar Sarma <dipankar@in.ibm.com>

Use copy_to_user, not memcpy with user buffers
parent 82b73ef9
...@@ -153,17 +153,15 @@ ssize_t do_read(struct file *pFile, char *pUserBuffer, size_t BufferSize, loff_t ...@@ -153,17 +153,15 @@ ssize_t do_read(struct file *pFile, char *pUserBuffer, size_t BufferSize, loff_t
klog_t *pHeadItem; klog_t *pHeadItem;
if (BufferSize < sizeof(klog_t)) if (BufferSize < sizeof(klog_t))
{
printk(KERN_WARNING "Divas: Divalog buffer specifed a size that is too small (%d - %d required)\n",
BufferSize, sizeof(klog_t));
return -EIO; return -EIO;
}
pHeadItem = (klog_t *) DivasLogFifoRead(); pHeadItem = (klog_t *) DivasLogFifoRead();
if (pHeadItem) if (pHeadItem) {
{ if (copy_to_user(pClientLogBuffer, pHeadItem, sizeof(klog_t))) {
memcpy(pClientLogBuffer, pHeadItem, sizeof(klog_t)); kfree(pHeadItem);
return -EFAULT;
}
kfree(pHeadItem); kfree(pHeadItem);
return sizeof(klog_t); return sizeof(klog_t);
} }
......
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