* [patch] net: remove an unneeded check
@ 2013-07-29 19:15 Dan Carpenter
2013-07-29 21:17 ` Jiri Pirko
` (2 more replies)
0 siblings, 3 replies; 5+ messages in thread
From: Dan Carpenter @ 2013-07-29 19:15 UTC (permalink / raw)
To: David S. Miller
Cc: Alexey Kuznetsov, James Morris, Hideaki YOSHIFUJI,
Patrick McHardy, netdev, kernel-janitors
"ifa->ifa_label" is an array inside the in_ifaddr struct. It can never
be NULL so we can remove this check.
Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
diff --git a/net/ipv4/devinet.c b/net/ipv4/devinet.c
index 8d48c39..1b7f7ae 100644
--- a/net/ipv4/devinet.c
+++ b/net/ipv4/devinet.c
@@ -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 =
^ permalink raw reply related [flat|nested] 5+ messages in thread
* Re: [patch] net: remove an unneeded check
2013-07-29 19:15 [patch] net: remove an unneeded check Dan Carpenter
@ 2013-07-29 21:17 ` Jiri Pirko
2013-07-31 2:24 ` David Miller
2013-08-05 18:18 ` Rustad, Mark D
2 siblings, 0 replies; 5+ messages in thread
From: Jiri Pirko @ 2013-07-29 21:17 UTC (permalink / raw)
To: Dan Carpenter
Cc: David S. Miller, Alexey Kuznetsov, James Morris,
Hideaki YOSHIFUJI, Patrick McHardy, netdev, kernel-janitors
Mon, Jul 29, 2013 at 09:15:19PM CEST, dan.carpenter@oracle.com wrote:
>"ifa->ifa_label" is an array inside the in_ifaddr struct. It can never
>be NULL so we can remove this check.
>
>Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
Reviewed-by: Jiri Pirko <jiri@resnulli.us>
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [patch] net: remove an unneeded check
2013-07-29 19:15 [patch] net: remove an unneeded check Dan Carpenter
2013-07-29 21:17 ` Jiri Pirko
@ 2013-07-31 2:24 ` David Miller
2013-08-05 18:18 ` Rustad, Mark D
2 siblings, 0 replies; 5+ messages in thread
From: David Miller @ 2013-07-31 2:24 UTC (permalink / raw)
To: dan.carpenter; +Cc: kuznet, jmorris, yoshfuji, kaber, netdev, kernel-janitors
From: Dan Carpenter <dan.carpenter@oracle.com>
Date: Mon, 29 Jul 2013 22:15:19 +0300
> "ifa->ifa_label" is an array inside the in_ifaddr struct. It can never
> be NULL so we can remove this check.
>
> Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
Yeah this has been like this forever, applied to net-next, thanks
Dan.
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [patch] net: remove an unneeded check
2013-07-29 19:15 [patch] net: remove an unneeded check Dan Carpenter
2013-07-29 21:17 ` Jiri Pirko
2013-07-31 2:24 ` David Miller
@ 2013-08-05 18:18 ` Rustad, Mark D
2013-08-06 12:04 ` Dan Carpenter
2 siblings, 1 reply; 5+ messages in thread
From: Rustad, Mark D @ 2013-08-05 18:18 UTC (permalink / raw)
To: Dan Carpenter
Cc: David S. Miller, Alexey Kuznetsov, James Morris,
Hideaki YOSHIFUJI, Patrick McHardy,
<netdev@vger.kernel.org>,
<kernel-janitors@vger.kernel.org>
On Jul 29, 2013, at 12:15 PM, Dan Carpenter <dan.carpenter@oracle.com> wrote:
> "ifa->ifa_label" is an array inside the in_ifaddr struct. It can never
> be NULL so we can remove this check.
>
> Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
>
> diff --git a/net/ipv4/devinet.c b/net/ipv4/devinet.c
> index 8d48c39..1b7f7ae 100644
> --- a/net/ipv4/devinet.c
> +++ b/net/ipv4/devinet.c
> @@ -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]?
> - 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 =
--
Mark Rustad, Networking Division, Intel Corporation
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [patch] net: remove an unneeded check
2013-08-05 18:18 ` Rustad, Mark D
@ 2013-08-06 12:04 ` Dan Carpenter
0 siblings, 0 replies; 5+ messages in thread
From: Dan Carpenter @ 2013-08-06 12:04 UTC (permalink / raw)
To: Rustad, Mark D
Cc: David S. Miller, Alexey Kuznetsov, James Morris,
Hideaki YOSHIFUJI, Patrick McHardy,
<netdev@vger.kernel.org>,
<kernel-janitors@vger.kernel.org>
On Mon, Aug 05, 2013 at 06:18:01PM +0000, Rustad, Mark D wrote:
> On Jul 29, 2013, at 12:15 PM, Dan Carpenter <dan.carpenter@oracle.com> wrote:
>
> > "ifa->ifa_label" is an array inside the in_ifaddr struct. It can never
> > be NULL so we can remove this check.
> >
> > Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
> >
> > diff --git a/net/ipv4/devinet.c b/net/ipv4/devinet.c
> > index 8d48c39..1b7f7ae 100644
> > --- a/net/ipv4/devinet.c
> > +++ b/net/ipv4/devinet.c
> > @@ -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
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2013-08-06 12:05 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2013-07-29 19:15 [patch] net: remove an unneeded check Dan Carpenter
2013-07-29 21:17 ` Jiri Pirko
2013-07-31 2:24 ` David Miller
2013-08-05 18:18 ` Rustad, Mark D
2013-08-06 12:04 ` Dan Carpenter
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).