I think there are newbie include me still use ifconfig utility. 
So when I check this code, it can be optimized.

> -----Original Message-----
> From: [email protected] [mailto:[email protected]]
> On Behalf Of Cong Wang
> Sent: Tuesday, November 22, 2016 12:20 PM
> To: YUAN Linyu
> Cc: David Miller; [email protected]; [email protected]
> Subject: Re: [PATCH] net: ioctl SIOCSIFADDR minor cleanup
> 
> On Tue, Nov 15, 2016 at 7:57 PM, YUAN Linyu
> <[email protected]> wrote:
> > No, this patch will not change dev->name,
> > It's care about ifa->ifa_label.
> >> -                     if (colon)
> >> -                             memcpy(ifa->ifa_label, ifr.ifr_name,
> IFNAMSIZ);
> >> -                     else
> >> -                             memcpy(ifa->ifa_label, dev->name,
> IFNAMSIZ);
> > When ifr.ifr_name have no colon, dev->name must equal to ifr.ifr_name.
> > So we change to
> >> -                     else
> >> -                             memcpy(ifa->ifa_label, ifr.ifr_name,
> IFNAMSIZ);
> > Then if and else do same thing. Just one line is enough,
> > memcpy(ifa->ifa_label, ifr.ifr_name, IFNAMSIZ);
> >
> 
> I don't understand why you try to optimize a slow path and some kind of
> obsolete code.

Reply via email to