lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date:   Sat, 31 Mar 2018 00:05:27 -0700
From:   Joe Perches <joe@...ches.com>
To:     Michael Chan <michael.chan@...adcom.com>,
        Claudiu Manoil <claudiu.manoil@...escale.com>
Cc:     netdev@...r.kernel.org, linux-kernel@...r.kernel.org
Subject: [PATCH 12/12] ethernet: Use ether_zero_addr instead of local statics

This saves a small amount of object code.

Miscellanea:

o __b44_cam_write now use const u8 *data instead of unsigned char *
  to avoid compiler warnings as it doesn't modify data

Signed-off-by: Joe Perches <joe@...ches.com>
---
 drivers/net/ethernet/broadcom/b44.c      | 5 ++---
 drivers/net/ethernet/freescale/gianfar.c | 3 +--
 2 files changed, 3 insertions(+), 5 deletions(-)

diff --git a/drivers/net/ethernet/broadcom/b44.c b/drivers/net/ethernet/broadcom/b44.c
index e445ab724827..30879ff7de19 100644
--- a/drivers/net/ethernet/broadcom/b44.c
+++ b/drivers/net/ethernet/broadcom/b44.c
@@ -220,7 +220,7 @@ static inline void __b44_cam_read(struct b44 *bp, unsigned char *data, int index
 	data[1] = (val >> 0) & 0xFF;
 }
 
-static inline void __b44_cam_write(struct b44 *bp, unsigned char *data, int index)
+static inline void __b44_cam_write(struct b44 *bp, const u8 *data, int index)
 {
 	u32 val;
 
@@ -1744,7 +1744,6 @@ static void __b44_set_rx_mode(struct net_device *dev)
 		val |= RXCONFIG_PROMISC;
 		bw32(bp, B44_RXCONFIG, val);
 	} else {
-		unsigned char zero[6] = {0, 0, 0, 0, 0, 0};
 		int i = 1;
 
 		__b44_set_mac_addr(bp);
@@ -1756,7 +1755,7 @@ static void __b44_set_rx_mode(struct net_device *dev)
 			i = __b44_load_mcast(bp, dev);
 
 		for (; i < 64; i++)
-			__b44_cam_write(bp, zero, i);
+			__b44_cam_write(bp, ether_zero_addr, i);
 
 		bw32(bp, B44_RXCONFIG, val);
         	val = br32(bp, B44_CAM_CTRL);
diff --git a/drivers/net/ethernet/freescale/gianfar.c b/drivers/net/ethernet/freescale/gianfar.c
index f27f9bae1a4a..24d8c85f8f4e 100644
--- a/drivers/net/ethernet/freescale/gianfar.c
+++ b/drivers/net/ethernet/freescale/gianfar.c
@@ -3501,10 +3501,9 @@ static void gfar_set_multi(struct net_device *dev)
 static void gfar_clear_exact_match(struct net_device *dev)
 {
 	int idx;
-	static const u8 zero_arr[ETH_ALEN] = {0, 0, 0, 0, 0, 0};
 
 	for (idx = 1; idx < GFAR_EM_NUM + 1; idx++)
-		gfar_set_mac_for_addr(dev, idx, zero_arr);
+		gfar_set_mac_for_addr(dev, idx, ether_zero_addr);
 }
 
 /* Set the appropriate hash bit for the given addr */
-- 
2.15.0

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ