[PATCH 10/12] staging: ks7010: replace magic number 12

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Function uses magic number 12. Number is used for a block of two
802.11 MAC ethernet addresses. There is already a global constant
ETH_ALEN defined to the number of octets in an 802.11 MAC ethernet
address. The header file containing this definition is already
included.

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

Replace magic number 12 with ETH_ALEN * 2.

Signed-off-by: Tobin C. Harding <me@xxxxxxxx>
---
 drivers/staging/ks7010/ks_hostif.c | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/drivers/staging/ks7010/ks_hostif.c b/drivers/staging/ks7010/ks_hostif.c
index 18c006d..f1ce049 100644
--- a/drivers/staging/ks7010/ks_hostif.c
+++ b/drivers/staging/ks7010/ks_hostif.c
@@ -1178,10 +1178,10 @@ int hostif_data_request(struct ks_wlan_private *priv, struct sk_buff *skb)
 	}
 
 	/* MAC address copy */
-	memcpy(p, buffer, 12);	/* DST/SRC MAC address */
-	p += 12;
-	buffer += 12;
-	length -= 12;
+	memcpy(p, buffer, ETH_ALEN * 2);	/* DST/SRC MAC address */
+	p += ETH_ALEN * 2;
+	buffer += ETH_ALEN * 2;
+	length -= ETH_ALEN * 2;
 	/* EtherType/Length check */
 	if (*(buffer + 1) + (*buffer << MICHAEL_MIC_LEN) > 1500) {
 		/* ProtocolEAP = *(buffer+1) + (*buffer << 8); */
-- 
2.7.4

_______________________________________________
devel mailing list
devel@xxxxxxxxxxxxxxxxxxxxxx
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel



[Index of Archives]     [Linux Driver Backports]     [DMA Engine]     [Linux GPIO]     [Linux SPI]     [Video for Linux]     [Linux USB Devel]     [Linux Coverity]     [Linux Audio Users]     [Linux Kernel]     [Linux SCSI]     [Yosemite Backpacking]
  Powered by Linux