lkml.org 
[lkml]   [1999]   [Jun]   [23]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
Date
From
SubjectRe: bug in fbmem.c,
Let me know if this fixes it.

JeffIndex: fbmem.c
===================================================================
RCS file: /usr/local/cvsroot/linux_2_3/drivers/video/fbmem.c,v
retrieving revision 1.1.1.1.24.2
diff -u -r1.1.1.1.24.2 fbmem.c
--- fbmem.c 1999/06/06 20:31:09 1.1.1.1.24.2
+++ fbmem.c 1999/06/23 13:37:02
@@ -30,9 +30,7 @@
#if defined(__mc68000__) || defined(CONFIG_APUS)
#include <asm/setup.h>
#endif
-#ifdef __powerpc__
#include <asm/io.h>
-#endif
#include <asm/uaccess.h>
#include <asm/page.h>
#include <asm/pgtable.h>
@@ -278,9 +276,14 @@
fb->fb_get_fix(&fix,PROC_CONSOLE(info), info);
base_addr=info->disp->screen_base;
copy_size=(count + p <= fix.smem_len ? count : fix.smem_len - p);
- if (copy_to_user(buf, base_addr+p, copy_size))
- return -EFAULT;
- *ppos += copy_size;
+ if (copy_size > 0) {
+ char tmpbuf [copy_size];
+
+ memcpy_fromio ((void *)&tmpbuf, base_addr+p, copy_size);
+ if (copy_to_user(buf, (void *)&tmpbuf, copy_size))
+ return -EFAULT;
+ *ppos += copy_size;
+ }
return copy_size;
}

@@ -302,9 +305,14 @@
fb->fb_get_fix(&fix, PROC_CONSOLE(info), info);
base_addr=info->disp->screen_base;
copy_size=(count + p <= fix.smem_len ? count : fix.smem_len - p);
- if (copy_from_user(base_addr+p, buf, copy_size))
- return -EFAULT;
- file->f_pos += copy_size;
+ if (copy_size > 0) {
+ char tmpbuf [copy_size];
+
+ if (copy_from_user((void *)&tmpbuf, buf, copy_size))
+ return -EFAULT;
+ memcpy_toio (base_addr+p, (void *)&tmpbuf, copy_size);
+ file->f_pos += copy_size;
+ }
return copy_size;
}
\
 
 \ /
  Last update: 2005-03-22 13:52    [from the cache]
©2003-2011 Jasper Spaans