lkml.org 
[lkml]   [2003]   [Jun]   [10]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
Date
From
SubjectRe: Misc 2.5 Fixes: cp-user-eicon


Use copy_to_user, not memcpy with user buffers


drivers/isdn/eicon/linchr.c | 10 +++++-----
1 files changed, 5 insertions(+), 5 deletions(-)

diff -puN drivers/isdn/eicon/linchr.c~cp-user-eicon drivers/isdn/eicon/linchr.c
--- linux-2.5.70-ds/drivers/isdn/eicon/linchr.c~cp-user-eicon 2003-06-08 03:30:31.000000000 +0530
+++ linux-2.5.70-ds-dipankar/drivers/isdn/eicon/linchr.c 2003-06-08 03:30:31.000000000 +0530
@@ -153,17 +153,17 @@ ssize_t do_read(struct file *pFile, char
klog_t *pHeadItem;

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;
- }

pHeadItem = (klog_t *) DivasLogFifoRead();

if (pHeadItem)
{
- memcpy(pClientLogBuffer, pHeadItem, sizeof(klog_t));
+ if(copy_to_user(pClientLogBuffer, pHeadItem, sizeof(klog_t)))
+ {
+ kfree(pHeadItem);
+ return -EFAULT;
+ }
kfree(pHeadItem);
return sizeof(klog_t);
}
_
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/

\
 
 \ /
  Last update: 2005-03-22 13:36    [W:0.065 / U:7.108 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site