Message ID | CANeU7Qko4VY_hZbuuNVLbRjaiEeFAyb8VLDmew0zSz1SYrPA9w@mail.gmail.com (mailing list archive) |
---|---|
State | Mainlined, archived |
Headers | show |
On 12/12/2014 05:32 AM, Christopher Li wrote: > On Fri, Dec 5, 2014 at 9:39 PM, Hans Verkuil <hverkuil@xs4all.nl> wrote: >>> Still need more work to fix it. >> >> Any updates on this? >> > > The search is over. > > Ptr list sorting should use memmove instead of memcpy > > The target buffer is overlapped with source buffer. > This cause the duplicate entry warning reported by Hans. Fantastic! This fixes the problem, now I can concentrate on getting rid of the last few remaining sparse warnings in drivers/media. Regards, Hans > > Reported-by: Hans Verkuil <hverkuil@xs4all.nl> > Signed-off-by: Christopher Li <sparse@chrisli.org> > > diff --git a/sort.c b/sort.c > index afd7184..430ba44 100644 > --- a/sort.c > +++ b/sort.c > @@ -99,7 +99,7 @@ static void verify_seq_sorted (struct ptr_list *l, int n, > assert (nbuf >= nr); \ > memcpy ((b)->list, buffer, nr * sizeof (void *)); \ > nbuf -= nr; \ > - memcpy (buffer, buffer + nr, nbuf * sizeof (void *)); \ > + memmove (buffer, buffer + nr, nbuf * sizeof (void *)); \ > } while (0) > > > Chris > -- To unsubscribe from this list: send the line "unsubscribe linux-sparse" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
On Fri, Dec 12, 2014 at 12:32:47PM +0800, Christopher Li wrote: > On Fri, Dec 5, 2014 at 9:39 PM, Hans Verkuil <hverkuil@xs4all.nl> wrote: > >> Still need more work to fix it. > > > > Any updates on this? > > > > The search is over. > > Ptr list sorting should use memmove instead of memcpy > > The target buffer is overlapped with source buffer. > This cause the duplicate entry warning reported by Hans. > > Reported-by: Hans Verkuil <hverkuil@xs4all.nl> > Signed-off-by: Christopher Li <sparse@chrisli.org> > > diff --git a/sort.c b/sort.c > index afd7184..430ba44 100644 > --- a/sort.c > +++ b/sort.c > @@ -99,7 +99,7 @@ static void verify_seq_sorted (struct ptr_list *l, int n, > assert (nbuf >= nr); \ > memcpy ((b)->list, buffer, nr * sizeof (void *)); \ > nbuf -= nr; \ > - memcpy (buffer, buffer + nr, nbuf * sizeof (void *)); \ > + memmove (buffer, buffer + nr, nbuf * sizeof (void *)); \ > } while (0) Great catch, Chris! - Josh Triplett -- To unsubscribe from this list: send the line "unsubscribe linux-sparse" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
diff --git a/sort.c b/sort.c index afd7184..430ba44 100644 --- a/sort.c +++ b/sort.c @@ -99,7 +99,7 @@ static void verify_seq_sorted (struct ptr_list *l, int n, assert (nbuf >= nr); \ memcpy ((b)->list, buffer, nr * sizeof (void *)); \ nbuf -= nr; \ - memcpy (buffer, buffer + nr, nbuf * sizeof (void *)); \ + memmove (buffer, buffer + nr, nbuf * sizeof (void *)); \ } while (0)