Skip to contentSkip to conversation

8021q:Add missing statements to switch case in the function, register_vlan_device

PATCH RESEND Patrick McHardy 1 participant 1 message Mar 7, 2016 1 message not in the archive

Subsystems (2)
lore
Share & tools
lore

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

#1 lore raw
Quoted 15 lines · Nicholas Krause

This adds the proper snprintf and break statement for formatting the vlan_net structure pointer, vn's name using snprintf for if the switch case, VLAN_NAME_TYPE_PLUS_VID occurs for this particular switch statement inside the function, register_vlan_device.

---
 net/8021q/vlan.c | 3 +++
 1 file changed, 3 insertions(+)
net/8021q/vlan.c +0 -0
index 59555f0..91ef50e 100644

net/8021q/vlan.c static int register_vlan_device(struct net_device *real_dev, u16 vlan_id) · line 250

Quoted 5 lines
net/8021q/vlan.c +2 -0
@@ -246,8 +246,11 @@ static int register_vlan_device(struct net_device *real_dev, u16 vlan_id)
 		/* Put our vlan.VID in the name.
 		 * Name will look like:	 vlan0005
 		 */
+		snprintf(name, IFNAMSIZ, "%s%i", real_dev->name, vlan_id);
+		break;

As the comment indicates, the fall-through is intended like this.

Quoted 9 lines
net/8021q/vlan.c +1 -0
 	default:
 		snprintf(name, IFNAMSIZ, "vlan%.4i", vlan_id);
+		break;
 	}
 
 	new_dev = alloc_netdev(sizeof(struct vlan_dev_priv), name,
Signature · 1 line
2.1.4