All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] staging/ozwpan: Fix zero address check in oz_set_active_pd
@ 2012-09-03 19:17 Andi Kleen
  2012-09-03 19:39 ` Rupesh Gujare
  0 siblings, 1 reply; 4+ messages in thread
From: Andi Kleen @ 2012-09-03 19:17 UTC (permalink / raw)
  To: greg, linux-kernel, rgujare, ckelly


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;

^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [PATCH] staging/ozwpan: Fix zero address check in oz_set_active_pd
  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
  2012-09-03 19:54   ` Andi Kleen
  0 siblings, 1 reply; 4+ messages in thread
From: Rupesh Gujare @ 2012-09-03 19:39 UTC (permalink / raw)
  To: Andi Kleen; +Cc: greg, linux-kernel, ckelly

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



^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] staging/ozwpan: Fix zero address check in oz_set_active_pd
  2012-09-03 19:39 ` Rupesh Gujare
@ 2012-09-03 19:54   ` Andi Kleen
  2012-09-04 19:44     ` Greg KH
  0 siblings, 1 reply; 4+ messages in thread
From: Andi Kleen @ 2012-09-03 19:54 UTC (permalink / raw)
  To: Rupesh Gujare; +Cc: Andi Kleen, greg, linux-kernel, ckelly

> Its already fixed by this patch :-
> 
> http://driverdev.linuxdriverproject.org/pipermail/devel/2012-August/029734.html

Should be in 3.6 then as it's a bug fix.

-Andi

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] staging/ozwpan: Fix zero address check in oz_set_active_pd
  2012-09-03 19:54   ` Andi Kleen
@ 2012-09-04 19:44     ` Greg KH
  0 siblings, 0 replies; 4+ messages in thread
From: Greg KH @ 2012-09-04 19:44 UTC (permalink / raw)
  To: Andi Kleen; +Cc: Rupesh Gujare, linux-kernel, ckelly

On Mon, Sep 03, 2012 at 09:54:39PM +0200, Andi Kleen wrote:
> > Its already fixed by this patch :-
> > 
> > http://driverdev.linuxdriverproject.org/pipermail/devel/2012-August/029734.html
> 
> Should be in 3.6 then as it's a bug fix.

I agree, will do.

greg k-h

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2012-09-04 19:47 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
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
2012-09-03 19:54   ` Andi Kleen
2012-09-04 19:44     ` Greg KH

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.