staging/ozwpan: Fix zero address check in oz_set_active_pd
PATCH 1/1 staging/ozwpan: Fix zero address check in oz_set_active_pd
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))) {
^drivers/staging/ozwpan/ozcdev.c +1 -1
@@ -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 ;
Quoted 17 lines · Andi Kleen
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 <[email protected]>drivers/staging/ozwpan/ozcdev.c +0
-0
drivers/staging/ozwpan/ozcdev.c static int oz_set_active_pd(u8 *addr) · line 219
Quoted 8 lines
drivers/staging/ozwpan/ozcdev.c +1
-1@@ -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
Signature · 2 lines
Regards, Rupesh Gujare
Quoted 3 lines
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
Quoted 5 lines · Andi Kleen
Quoted 3 lines
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