hi david,
> -----Original Message----- > From: netdev-ow...@vger.kernel.org [mailto:netdev-ow...@vger.kernel.org] > On Behalf Of David Miller > Sent: Wednesday, November 16, 2016 11:01 AM > To: cug...@163.com > Cc: netdev@vger.kernel.org; YUAN Linyu > Subject: Re: [PATCH] net: ioctl SIOCSIFADDR minor cleanup > > From: yuan linyu <cug...@163.com> > Date: Tue, 15 Nov 2016 20:44:59 +0800 > > > @@ -1063,10 +1063,7 @@ int devinet_ioctl(struct net *net, unsigned int > cmd, void __user *arg) > > if (!ifa) > > break; > > INIT_HLIST_NODE(&ifa->hash); > > - if (colon) > > - memcpy(ifa->ifa_label, ifr.ifr_name, IFNAMSIZ); > > - else > > - memcpy(ifa->ifa_label, dev->name, IFNAMSIZ); > > + memcpy(ifa->ifa_label, ifr.ifr_name, IFNAMSIZ); > > This is an incorrect and untested change. > > If there is a colon character in ifr.ifr_name, earlier in this function > we will: > > 1) First replace that colon with a NULL character. > > 2) Perform __dev_get_by_name() on the result. > > 3) Put the ":" colon character back into ifr.ifr_name > > So the two strings ifr.ifr_name and dev->name can in fact be different > here. Therefore the code has to be left as it is. Here we assign value to ifa->ifa_label. orginal code means when reqest name have colon, then label name will have colon. If request name have no colon, label name will same as dev-name, it's also have no colon. So assign label to request name will do same thing as original code. thanks