[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-ID: <20120903191721.GX16230@one.firstfloor.org>
Date: Mon, 3 Sep 2012 21:17:21 +0200
From: Andi Kleen <andi@...stfloor.org>
To: greg@...ah.com, linux-kernel@...r.kernel.org,
rgujare@...odevices.com, ckelly@...odevices.com
Subject: [PATCH] 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))) {
^
Signed-off-by: Andi Kleen <ak@...ux.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;
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists