Skip to contentSkip to conversation

net: fix wrong length of mac address

PATCH Superseded Amos Kong 4 participants 6 messages Jan 18, 2013 – Jan 19, 2013 1 message not in the archive

Subsystems (3)
lore
Share & tools
lore

Amos Kong

author
#0 lore raw

PATCH v2 1/1 net: fix wrong length of mac address

Typo, it should be ETH_ALEN.

---
v2: update commitlog, fix cc list

---
 drivers/net/hyperv/netvsc_drv.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/net/hyperv/netvsc_drv.c +1 -1
index f825a62..8264f0e 100644
@@ -349,7 +349,7 @@ static int netvsc_set_mac_addr(struct net_device *ndev, void *p)
 	struct net_device_context *ndevctx = netdev_priv(ndev);
 	struct hv_device *hdev =  ndevctx->device_ctx;
 	struct sockaddr *addr = p;
-	char save_adr[14];
+	char save_adr[ETH_ALEN];
 	unsigned char save_aatype;
 	int err;
 
Signature · 1 line
1.7.11.7
#1 lore raw
Quoted 14 lines · Amos Kong

Typo, it should be ETH_ALEN.

---
v2: update commitlog, fix cc list

---
 drivers/net/hyperv/netvsc_drv.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/net/hyperv/netvsc_drv.c +0 -0
index f825a62..8264f0e 100644

drivers/net/hyperv/netvsc_drv.c static int netvsc_set_mac_addr(struct net_device *ndev, void *p) · line 354

Quoted 7 lines
drivers/net/hyperv/netvsc_drv.c +1 -1
@@ -349,7 +349,7 @@ static int netvsc_set_mac_addr(struct net_device *ndev, void *p)
 	struct net_device_context *ndevctx = netdev_priv(ndev);
 	struct hv_device *hdev =  ndevctx->device_ctx;
 	struct sockaddr *addr = p;
-	char save_adr[14];
+	char save_adr[ETH_ALEN];
 	unsigned char save_aatype;
 	int err;

While you're at it, you should fix drivers/net/hyperv/hyperv_net.h:

struct netvsc_device_info {

drivers/net/hyperv/netvsc_drv.c static int netvsc_set_mac_addr(struct net_device *ndev, void *p) · line 355

Quoted 1 line
drivers/net/hyperv/netvsc_drv.c +0 -0
 >>     unsigned char mac_adr[6];

bool link_state; /* 0 - link up, 1 - link down */
int ring_size;
};

Cheers,
-PJ

A message that is not in the archive (sent off-list or not yet received): [email protected]

maintainer
#3 lore raw

From: PJ Waskiewicz <WaskiewiczJr@ppwaskie-mobl2>
Date: Fri, 18 Jan 2013 00:30:32 -0800

Quoted 26 lines · Amos Kong
Quoted 14 lines

Typo, it should be ETH_ALEN.

---
v2: update commitlog, fix cc list

---
 drivers/net/hyperv/netvsc_drv.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/net/hyperv/netvsc_drv.c +0 -0
index f825a62..8264f0e 100644

drivers/net/hyperv/netvsc_drv.c static int netvsc_set_mac_addr(struct net_device *ndev, void *p) · line 354

Quoted 7 lines
drivers/net/hyperv/netvsc_drv.c +1 -1
@@ -349,7 +349,7 @@ static int netvsc_set_mac_addr(struct net_device *ndev, void *p)
 	struct net_device_context *ndevctx = netdev_priv(ndev);
 	struct hv_device *hdev =  ndevctx->device_ctx;
 	struct sockaddr *addr = p;
-	char save_adr[14];
+	char save_adr[ETH_ALEN];
 	unsigned char save_aatype;
 	int err;

While you're at it, you should also update drivers/net/hyperv/hyperv_net.h to also fix the mac_adr definition in struct netvsc_device_info:

Quoted 2 lines

struct netvsc_device_info {

Quoted 1 line
drivers/net/hyperv/netvsc_drv.c +0 -0
 >>     unsigned char mac_adr[6];

Agreed.

author
#4 lore raw

PATCH v3 1/1 net/hyperv: fix wrong length of mac address

In reply to a message not in the archive

This patch fixed wrong mac length, it should be ETH_ALEN, also replaced the hardcode 6 in hyperv_net.h

---
v2: update commitlog, fix cc list
v3: fix hardcode length in hyperv_net.h

---
 drivers/net/hyperv/hyperv_net.h | 2 +-
 drivers/net/hyperv/netvsc_drv.c | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)
drivers/net/hyperv/hyperv_net.h +1 -1
index 5fd6f46..e6fe0d8 100644
@@ -84,7 +84,7 @@ struct hv_netvsc_packet {
 };
 
 struct netvsc_device_info {
-	unsigned char mac_adr[6];
+	unsigned char mac_adr[ETH_ALEN];
 	bool link_state;	/* 0 - link up, 1 - link down */
 	int  ring_size;
 };
drivers/net/hyperv/netvsc_drv.c +1 -1
index f825a62..8264f0e 100644
@@ -349,7 +349,7 @@ static int netvsc_set_mac_addr(struct net_device *ndev, void *p)
 	struct net_device_context *ndevctx = netdev_priv(ndev);
 	struct hv_device *hdev =  ndevctx->device_ctx;
 	struct sockaddr *addr = p;
-	char save_adr[14];
+	char save_adr[ETH_ALEN];
 	unsigned char save_aatype;
 	int err;
 
Signature · 1 line
1.7.11.7
maintainer Acked-by on v3 1/1
#5 lore raw

RE: [PATCH v3] net/hyperv: fix wrong length of mac address

Quoted 7 lines

From: Amos Kong

Sent: Friday, January 18, 2013 9:52 PM
To: [email protected]; KY Srinivasan; Haiyang Zhang
Cc: [email protected]; [email protected]; Amos Kong
Subject: [PATCH v3] net/hyperv: fix wrong length of mac address

Quoted 8 lines

This patch fixed wrong mac length, it should be ETH_ALEN, also replaced the hardcode 6 in hyperv_net.h

---
v2: update commitlog, fix cc list
v3: fix hardcode length in hyperv_net.h
---

maintainer Applied
#6 lore raw

Re: [PATCH v3] net/hyperv: fix wrong length of mac address

From: Haiyang Zhang <[email protected]>
Date: Sat, 19 Jan 2013 15:07:14 +0000

Quoted 10 lines
Quoted 10 lines

From: Amos Kong

Sent: Friday, January 18, 2013 9:52 PM
To: [email protected]; KY Srinivasan; Haiyang Zhang
Cc: [email protected]; [email protected]; Amos Kong
Subject: [PATCH v3] net/hyperv: fix wrong length of mac address

This patch fixed wrong mac length, it should be ETH_ALEN, also replaced the hardcode 6 in hyperv_net.h

Quoted 7 lines
Quoted 5 lines

---
v2: update commitlog, fix cc list
v3: fix hardcode length in hyperv_net.h
---

Applied, thanks.