Re: bug in fbmem.c,

Jeff Garzik (jgarzik@pobox.com)
Wed, 23 Jun 1999 09:35:43 -0400


This is a multi-part message in MIME format.
--------------DDC0733EF0F328321B2B9EC7
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit

Let me know if this fixes it.

Jeff
--------------DDC0733EF0F328321B2B9EC7
Content-Type: text/plain; charset=us-ascii;
name="patch"
Content-Transfer-Encoding: 7bit
Content-Disposition: inline;
filename="patch"

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

--------------DDC0733EF0F328321B2B9EC7--

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.rutgers.edu
Please read the FAQ at http://www.tux.org/lkml/