lkml.org 
[lkml]   [1999]   [Jun]   [22]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: bug in fbmem.c,
Vignaud Jean-Baptiste wrote:
> I'v traced a little bug in the fbmem code. i don't know if it's the right
> way to
> correct it, but on my SX164 alpha this seems to work.

Good catch! I guess I shouldn't only use the sight of a penguin and
running XF86_FBDev as tests. ;-)

You cannot eliminate the copy_to_user() and copy_from_user() calls. I
don't recall what type of addresses copy_xxx_user() wants, but I suspect
you either need a copy buffer

memcpy_fromio (bufruf, base_addr+p, copy_size);
if (copy_to_user(buf, bufruf, copy_size)) ...
or maybe you can get away with some variant of

if (copy_to_user(buf, __phys_to_virt (base_addr+p), copy_size) ...
Regards,

Jeff





> --- fbmem.c Wed Mar 17 18:17:22 1999
> +++ fbmem.c.new Tue Jun 22 11:04:03 1999
> @@ -30,7 +30,7 @@
> #if defined(__mc68000__) || defined(CONFIG_APUS)
> #include <asm/setup.h>
> #endif
> -#ifdef __powerpc__
> +#if defined(__powerpc__) || defined(__alpha__)
> #include <asm/io.h>
> #endif
> #include <asm/uaccess.h>
> @@ -251,8 +251,7 @@
> fb->fb_get_fix(&fix,PROC_CONSOLE(), 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;
> + memcpy_fromio(buf, base_addr+p, copy_size);
> *ppos += copy_size;
> return copy_size;
> }
> @@ -275,8 +274,7 @@
> fb->fb_get_fix(&fix, PROC_CONSOLE(), 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;
> + memcpy_toio(base_addr+p, buf, copy_size);
> file->f_pos += copy_size;
> return copy_size;
> }
>
> -
> 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/

-
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/

\
 
 \ /
  Last update: 2005-03-22 13:52    [W:0.176 / U:0.560 seconds]
©2003-2011 Jasper Spaans. Advertise on this site