Sfoglia il codice sorgente

net: vlan: Use sizeof instead of literal number

Use sizeof variable instead of literal number to enhance the readability.

Signed-off-by: Gao Feng <fgao@ikuai8.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Gao Feng 8 anni fa
parent
commit
9c403b6bee
1 ha cambiato i file con 2 aggiunte e 2 eliminazioni
  1. 2 2
      net/8021q/vlan.c

+ 2 - 2
net/8021q/vlan.c

@@ -515,8 +515,8 @@ static int vlan_ioctl_handler(struct net *net, void __user *arg)
 		return -EFAULT;
 
 	/* Null terminate this sucker, just in case. */
-	args.device1[23] = 0;
-	args.u.device2[23] = 0;
+	args.device1[sizeof(args.device1) - 1] = 0;
+	args.u.device2[sizeof(args.u.device2) - 1] = 0;
 
 	rtnl_lock();