I think there are newbie include me still use ifconfig utility. So when I check this code, it can be optimized.
> -----Original Message----- > From: netdev-ow...@vger.kernel.org [mailto:netdev-ow...@vger.kernel.org] > On Behalf Of Cong Wang > Sent: Tuesday, November 22, 2016 12:20 PM > To: YUAN Linyu > Cc: David Miller; cug...@163.com; netdev@vger.kernel.org > Subject: Re: [PATCH] net: ioctl SIOCSIFADDR minor cleanup > > On Tue, Nov 15, 2016 at 7:57 PM, YUAN Linyu > <linyu.y...@alcatel-sbell.com.cn> 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.