[PATCH 09/12] staging: ks7010: replace magic number 6

Tobin C. Harding me at tobin.cc
Mon Mar 27 00:29:46 UTC 2017


Function uses magic number 6. Number refers to the number of octets in
an 802.11 MAC ethernet address and as such, already has a global
constant defined ETH_ALEN (header is already included).

include/uapi/linux/if_ether.h
 define ETH_ALEN	6	/* Octets in one ethernet addr	 */

Replace magic number 6 with ETH_ALEN.

Signed-off-by: Tobin C. Harding <me at tobin.cc>
---
 drivers/staging/ks7010/ks_hostif.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/staging/ks7010/ks_hostif.c b/drivers/staging/ks7010/ks_hostif.c
index 0455cda..18c006d 100644
--- a/drivers/staging/ks7010/ks_hostif.c
+++ b/drivers/staging/ks7010/ks_hostif.c
@@ -1154,7 +1154,7 @@ int hostif_data_request(struct ks_wlan_private *priv, struct sk_buff *skb)
 	}
 
 	DPRINTK(4, "skb_buff length=%d\n", skb_len);
-	pp = kmalloc(hif_align_size(sizeof(*pp) + 6 + skb_len + MICHAEL_MIC_LEN),
+	pp = kmalloc(hif_align_size(sizeof(*pp) + ETH_ALEN + skb_len + MICHAEL_MIC_LEN),
 		     KS_WLAN_MEM_FLAG);
 
 	if (!pp) {
-- 
2.7.4



More information about the devel mailing list