net: remove an unneeded check
Subsystems (4)
PATCH 1/1 net: remove an unneeded check
"ifa->ifa_label" is an array inside the in_ifaddr struct. It can never be NULL so we can remove this check.
net/ipv4/devinet.c +1 -4
@@ -1124,10 +1124,7 @@ static int inet_gifconf(struct net_device *dev, char __user *buf, int len)if (len < (int )sizeof (ifr))break ;memset (&ifr,0 ,sizeof (struct ifreq )); -if (ifa->ifa_label) -strcpy (ifr.ifr_name, ifa->ifa_label); -else -strcpy (ifr.ifr_name, dev->name); +strcpy (ifr.ifr_name, ifa->ifa_label); (*(struct sockaddr_in *)&ifr.ifr_addr).sin_family =AF_INET ; (*(struct sockaddr_in *)&ifr.ifr_addr).sin_addr.s_addr
Quoted 4 lines · Mon, Jul 29, 2013 at 09:15:19PM CEST, [email protected] wrote:
"
ifa->ifa_label" is an array inside thein_ifaddrstruct. It can never be NULL so we can remove this check.Signed-off-by Dan Carpenter <[email protected]>
David Miller
maintainerFrom: Dan Carpenter <[email protected]>
Date: Mon, 29 Jul 2013 22:15:19 +0300
Quoted 4 lines
"
ifa->ifa_label" is an array inside thein_ifaddrstruct. It can never be NULL so we can remove this check.Signed-off-by Dan Carpenter <[email protected]>
Yeah this has been like this forever, applied to net-next, thanks Dan.
Quoted 10 lines · Dan Carpenter
"
ifa->ifa_label" is an array inside thein_ifaddrstruct. It can never be NULL so we can remove this check.Signed-off-by Dan Carpenter <[email protected]>net/ipv4/devinet.c +0
-0
net/ipv4/devinet.c static int inet_gifconf(struct net_device *dev, char __user *buf, int len) · line 1127
Quoted 4 lines
net/ipv4/devinet.c +0
-1@@ -1124,10 +1124,7 @@ static int inet_gifconf(struct net_device *dev, char __user *buf, int len)if (len < (int )sizeof (ifr))break ;memset (&ifr,0 ,sizeof (struct ifreq )); -if (ifa->ifa_label)
Is there any possibility that this was meant to check ifa->ifa_label[0]?
Quoted 7 lines
net/ipv4/devinet.c +1
-3-strcpy (ifr.ifr_name, ifa->ifa_label); - else - strcpy(ifr.ifr_name, dev->name); +strcpy (ifr.ifr_name, ifa->ifa_label); (*(struct sockaddr_in *)&ifr.ifr_addr).sin_family =AF_INET ; (*(struct sockaddr_in *)&ifr.ifr_addr).sin_addr.s_addr
Signature · 1 line
Mark Rustad, Networking Division, Intel Corporation
Quoted 7 lines · Mark D
Quoted 5 lines · Dan Carpenter
"
ifa->ifa_label" is an array inside thein_ifaddrstruct. It can never be NULL so we can remove this check.Signed-off-by Dan Carpenter <[email protected]>
Quoted 11 lines
net/ipv4/devinet.c static int inet_gifconf(struct net_device *dev, char __user *buf, int len) · line 1127
Quoted 9 lines
net/ipv4/devinet.c +0
-1@@ -1124,10 +1124,7 @@ static int inet_gifconf(struct net_device *dev, char __user *buf, int len)if (len < (int )sizeof (ifr))break ;memset (&ifr,0 ,sizeof (struct ifreq )); -if (ifa->ifa_label)Is there any possibility that this was meant to check ifa->ifa_label[0]?
It has been this way for almost 16 years and no one has complained. I should have put that into the changelog though, you are right.
regards,
dan carpenter