linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Rupesh Gujare <rgujare@ozmodevices.com>
To: Andi Kleen <andi@firstfloor.org>
Cc: <greg@kroah.com>, <linux-kernel@vger.kernel.org>,
	<ckelly@ozmodevices.com>
Subject: Re: [PATCH] staging/ozwpan: Fix zero address check in oz_set_active_pd
Date: Mon, 3 Sep 2012 20:39:43 +0100	[thread overview]
Message-ID: <5045077F.80700@ozmodevices.com> (raw)
In-Reply-To: <20120903191721.GX16230@one.firstfloor.org>

On 03/09/12 20:17, Andi Kleen wrote:
> gcc 4.8 warns about the incorrect memcmp size. I think it's supposed to
> be an ethernet address, so should be always 6 bytes.
>
> The code was wrong, would either compare 4 or 8 bytes (32bit vs 64bit)
>
> /backup/lsrc/git/linux-lto-2.6/drivers/staging/ozwpan/ozcdev.c: In function 'oz_set_active_pd':
> /backup/lsrc/git/linux-lto-2.6/drivers/staging/ozwpan/ozcdev.c:216:43: warning: argument to 'sizeof' in 'memcmp' call is the same expression as the destination; did you mean to provide an explicit length? [-Wsizeof-pointer-memaccess]
>     if (!memcmp(addr, "\0\0\0\0\0\0", sizeof(addr))) {
>                                             ^
> Signed-off-by: Andi Kleen <ak@linux.intel.com>
>
> diff --git a/drivers/staging/ozwpan/ozcdev.c b/drivers/staging/ozwpan/ozcdev.c
> index d983219..63c1b67 100644
> --- a/drivers/staging/ozwpan/ozcdev.c
> +++ b/drivers/staging/ozwpan/ozcdev.c
> @@ -213,7 +213,7 @@ static int oz_set_active_pd(u8 *addr)
>   		if (old_pd)
>   			oz_pd_put(old_pd);
>   	} else {
> -		if (!memcmp(addr, "\0\0\0\0\0\0", sizeof(addr))) {
> +		if (!memcmp(addr, "\0\0\0\0\0\0", ETH_ALEN)) {
>   			spin_lock_bh(&g_cdev.lock);
>   			pd = g_cdev.active_pd;
>   			g_cdev.active_pd = 0;
>

Its already fixed by this patch :-

http://driverdev.linuxdriverproject.org/pipermail/devel/2012-August/029734.html

-- 
Regards,
Rupesh Gujare



  reply	other threads:[~2012-09-03 19:40 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-09-03 19:17 [PATCH] staging/ozwpan: Fix zero address check in oz_set_active_pd Andi Kleen
2012-09-03 19:39 ` Rupesh Gujare [this message]
2012-09-03 19:54   ` Andi Kleen
2012-09-04 19:44     ` Greg KH

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=5045077F.80700@ozmodevices.com \
    --to=rgujare@ozmodevices.com \
    --cc=andi@firstfloor.org \
    --cc=ckelly@ozmodevices.com \
    --cc=greg@kroah.com \
    --cc=linux-kernel@vger.kernel.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).