staging: ozwpan: fix memcmp() test in oz_set_active_pd()
Subsystems (2)
PATCH 1/1 staging: ozwpan: fix memcmp() test in oz_set_active_pd()
"addr" is a pointer so it's either 4 or 8 bytes, but actually we want to compare 6 bytes (ETH_ALEN).
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 4 lines · Dan Carpenter
"addr" is a pointer so it's either 4 or 8 bytes, but actually we want to compare 6 bytes (
ETH_ALEN).Signed-off-by Dan Carpenter <[email protected]>
Quoted 14 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 ;
Signature · 2 lines
Regards, Rupesh Gujare
Quoted 9 lines · Dan Carpenter
Quoted 5 lines
"addr" is a pointer so it's either 4 or 8 bytes, but actually we want to compare 6 bytes (
ETH_ALEN).Signed-off-by Dan Carpenter <[email protected]>Acked-by Rupesh Gujare<[email protected]>
why not to use 'if (is_zero_ether_addr())" from linux/etherdevice.h Thanks
Tomas
Quoted 30 lines
Quoted 10 lines
drivers/staging/ozwpan/ozcdev.c +0
-0drivers/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 ;--
Regards,
Rupesh Gujare_______________________________________________
devel mailing list
[email protected]
http://driverdev.linuxdriverproject.org/mailman/listinfo/devel
Quoted 9 lines · Tomas Winkler
Quoted 7 lines · Dan Carpenter
Quoted 4 lines
"addr" is a pointer so it's either 4 or 8 bytes, but actually we want to compare 6 bytes (
ETH_ALEN).Signed-off-by Dan Carpenter <[email protected]>Acked-by Rupesh Gujare<[email protected]>why not to use 'if (
is_zero_ether_addr())" fromlinux/etherdevice.h
Tom,
Thanks for pointing this out, that looks more efficient. Interested in submitting a patch ?
Dan,
What do you think ?
Signature · 2 lines
Regards, Rupesh Gujare
Quoted 10 lines · Rupesh Gujare
Quoted 9 lines · Tomas Winkler
Quoted 7 lines · Dan Carpenter
Quoted 4 lines
"addr" is a pointer so it's either 4 or 8 bytes, but actually we want to compare 6 bytes (
ETH_ALEN).Signed-off-by Dan Carpenter <[email protected]>Acked-by Rupesh Gujare<[email protected]>why not to use 'if (
is_zero_ether_addr())" fromlinux/etherdevice.h
Quoted 9 lines
Tom,
Thanks for pointing this out, that looks more efficient. Interested in submitting a patch ?
Dan,
What do you think ?
Yes yes. Of course. It's the weekend and I'm traveling but I can redo this.
regards,
dan carpenter