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: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <Pine.LNX.4.44L0.0705081152590.3217-100000@iolanthe.rowland.org>
Date:	Tue, 8 May 2007 11:57:07 -0400 (EDT)
From:	Alan Stern <stern@...land.harvard.edu>
To:	Dan Kruchinin <dubalom@...il.com>
cc:	Greg KH <greg@...ah.com>,
	Andrew Morton <akpm@...ux-foundation.org>,
	Kernel development list <linux-kernel@...r.kernel.org>,
	USB development list <linux-usb-devel@...ts.sourceforge.net>
Subject: Re: [linux-usb-devel] [PATCH -mm] drivers/usb/core/config.c: kzalloc(0,
 ..)

On Tue, 8 May 2007, Greg KH wrote:

> >  The problem was in drivers/usb/core/config.c in function 
> >  usb_parse_interface:
> >  ---
> >  num_ep = num_ep_orig = alt->desc.bNumEndpoints;
> >  ...
> >  len = sizeof(struct usb_host_endpoint) * num_ep;
> >  alt->endpoint = kzalloc(len, GFP_KERNEL);
> >  ---
> > 
> >  num_ep can be 0, as it was in my case, so following patch makes this
> >  situation more obvious
> >  and clear.

How about instead just doing:

+	num_ep = max(num_ep, 1);
 	len = sizeof(struct usb_host_endpoint) * num_ep;

Also, wasn't it true at one point that it was legal to call kmalloc() with 
a length of 0?  ISTR seeing somewhere that it's true for regular malloc().

Alan Stern

-
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