kernel-janitors.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [staging-next] ozwpan: fix memcmp() test in oz_set_active_pd()
@ 2012-08-19 16:20 Tomas Winkler
  2012-09-04 17:31 ` Dan Carpenter
  2012-09-04 17:33 ` Dan Carpenter
  0 siblings, 2 replies; 3+ messages in thread
From: Tomas Winkler @ 2012-08-19 16:20 UTC (permalink / raw)
  To: kernel-janitors

"addr" is a pointer so it's either 4 or 8 bytes, but actually we want
to compare 6 bytes (ETH_ALEN).

As network stack already provides helper function
is_zero_ether_addr() we use that instead of memcmp

Signed-off-by: Tomas Winkler <tomas.winkler@intel.com>
Cc: Dan Carpenter <dan.carpenter@oracle.com>
Cc: Rupesh Gujare <rgujare@ozmodevices.com>
---
V1: by Dan Carpenter <dan.carpenter@oracle.com>
V2: replace memcmp with is_zero_ether_addr

 drivers/staging/ozwpan/ozcdev.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/drivers/staging/ozwpan/ozcdev.c b/drivers/staging/ozwpan/ozcdev.c
index d983219..77c4104 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 (is_zero_ether_addr(addr)) {
 			spin_lock_bh(&g_cdev.lock);
 			pd = g_cdev.active_pd;
 			g_cdev.active_pd = 0;
-- 
1.7.4.4


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

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

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-08-19 16:20 [staging-next] ozwpan: fix memcmp() test in oz_set_active_pd() Tomas Winkler
2012-09-04 17:31 ` Dan Carpenter
2012-09-04 17:33 ` Dan Carpenter

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).