lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite for Android: free password hash cracker in your pocket
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date:	Thu, 1 Mar 2007 08:42:09 +0100
From:	Jarek Poplawski <jarkao2@...pl>
To:	Jean Tourrilhes <jt@....hp.com>
Cc:	Greg Kroah-Hartman <gregkh@...e.de>,
	"David S\. Miller" <davem@...emloft.net>,
	Linux kernel mailing list <linux-kernel@...r.kernel.org>,
	netdev@...r.kernel.org
Subject: Re: [PATCH 2.6.20] kobject net ifindex + rename

On Wed, Feb 28, 2007 at 10:45:41AM -0800, Jean Tourrilhes wrote:
> On Wed, Feb 28, 2007 at 10:34:37AM +0100, Jarek Poplawski wrote:
> > On 28-02-2007 02:27, Jean Tourrilhes wrote:
> > > 	Hi all,
> > ...
> > > 	Patch for 2.6.20 is attached. The patch was tested on a system
> > > running the hotplug scripts, and on another system running udev.
> > > 
> > > 	Have fun...
> > > 
> > > 	Jean
> > > 
> > > Signed-off-by: Jean Tourrilhes <jt@....hp.com>
> > > 
> > > ---------------------------------------------------------
> > ...
> > > diff -u -p linux/net/core/net-sysfs.j1.c linux/net/core/net-sysfs.c
> > > --- linux/net/core/net-sysfs.j1.c	2007-02-27 15:01:08.000000000 -0800
> > > +++ linux/net/core/net-sysfs.c	2007-02-27 15:06:49.000000000 -0800
> > > @@ -412,6 +412,17 @@ static int netdev_uevent(struct class_de
> > >  	if ((size <= 0) || (i >= num_envp))
> > >  		return -ENOMEM;
> > >  
> > > +	/* pass ifindex to uevent.
> > > +	 * ifindex is useful as it won't change (interface name may change)
> > > +	 * and is what RtNetlink uses natively. */
> > > +	envp[i++] = buf;
> > > +	n = snprintf(buf, size, "IFINDEX=%d", dev->ifindex) + 1;
> > > +	buf += n;
> > > +	size -= n;
> > > +
> > > +	if ((size <= 0) || (i >= num_envp))
> > 
> > Btw.:
> > 1. if size == 10 and snprintf returns 9 (without NULL)
> >    then n == 10 (with NULL), so isn't it enough (here and above):
> >  
> > 	if ((size < 0) || (i >= num_envp))
> 
> 	I just cut'n'pasted the code a few line above. If the original
> code is incorrect, it need fixing. And it will need fixing in probably
> a lot of places.

I think you're kind of responsible for your part, at least.

> 
> > 2. shouldn't there be (here and above):
> >  
> > 		envp[--i] = NULL;
> > 
> 
> 	No, envp is local, so who cares.

But envp[i] isn't (at least here). So, I guess, a caller
of this function could care.

> > > + 	if ((size <= 0) || (i >= num_envp))
> > > + 		return -ENOMEM;

And one more thing (not necessarily for you):
ENOBUFS is probably more adequate here.

Cheers,
Jarek P.
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ