[PATCH] Use memmove instead of memcpy in fbblt.c when memory regions overlap.

Soeren Sandmann sandmann at cs.au.dk
Wed Apr 13 11:38:45 PDT 2011


Adam Tkac <atkac at redhat.com> writes:

> Hello,
>
> attached patch fixes wrong usage of memcpy. See
> https://bugs.freedesktop.org/show_bug.cgi?id=36165 for more info.
>
> Regards, Adam
>
> From b08e7198dc0141b8074d8fdff681019d86655a38 Mon Sep 17 00:00:00 2001
> From: Adam Tkac <atkac at redhat.com>
> Date: Tue, 12 Apr 2011 16:49:43 +0200
> Subject: [PATCH] Use memmove instead of memcpy in fbblt.c when memory regions
>  overlap.
>
> Signed-off-by: Adam Tkac <atkac at redhat.com>
> ---
>  fb/fb.h    |    4 ++++
>  fb/fbblt.c |    4 ++--
>  2 files changed, 6 insertions(+), 2 deletions(-)
>
> diff --git a/fb/fb.h b/fb/fb.h
> index eaa21ad..f68fe3b 100644
> --- a/fb/fb.h
> +++ b/fb/fb.h
> @@ -66,6 +66,9 @@
>      }                                                             \
>  } while(0)
>  
> +/* XXX: Is this enough? */
> +#define MEMMOVE_WRAPPED MEMCPY_WRAPPED

I don't believe MEMCPY_WRAPPED() is used outside fbblt.c, so we might as
well get rid of it and just define MEMMOVE_WRAPPED only. 

And no, I don't think using the existing MEMCPY_WRAPPED code is
enough. It has to select the correct direction for the loop based on the
overlap.


Soren


More information about the xorg-devel mailing list