All of lore.kernel.org
 help / color / mirror / Atom feed
From: Josh Triplett <josh@joshtriplett.org>
To: Christopher Li <sparse@chrisli.org>
Cc: Hans Verkuil <hverkuil@xs4all.nl>,
	Linux-Sparse <linux-sparse@vger.kernel.org>,
	Linus Torvalds <torvalds@linux-foundation.org>
Subject: Re: Bogus 'Initializer entry defined twice' warnings
Date: Fri, 12 Dec 2014 00:12:10 -0800	[thread overview]
Message-ID: <20141212081209.GA16645@thin> (raw)
In-Reply-To: <CANeU7Qko4VY_hZbuuNVLbRjaiEeFAyb8VLDmew0zSz1SYrPA9w@mail.gmail.com>

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

      parent reply	other threads:[~2014-12-12  8:12 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-08-29  8:10 Bogus 'Initializer entry defined twice' warnings Hans Verkuil
2014-11-05  7:44 ` Hans Verkuil
2014-11-05 10:49   ` Christopher Li
2014-11-12 15:39 ` Christopher Li
2014-12-05 13:39   ` Hans Verkuil
2014-12-09  1:11     ` Christopher Li
2014-12-12  4:32     ` Christopher Li
2014-12-12  8:04       ` Hans Verkuil
2014-12-12  8:12       ` Josh Triplett [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20141212081209.GA16645@thin \
    --to=josh@joshtriplett.org \
    --cc=hverkuil@xs4all.nl \
    --cc=linux-sparse@vger.kernel.org \
    --cc=sparse@chrisli.org \
    --cc=torvalds@linux-foundation.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.