linux/drivers/usb/host
KAMBAROV, ZAUR b2134bcd2e [PATCH] USB: coverity: (desc->bitmap)[] overrun fix
The length of the array desc->bitmap is 3, and not 4:

Definitions involved:

In drivers/usb/core/hcd.h

464  	#define bitmap 	DeviceRemovable

In drivers/usb/host/ohci-hub.c

395  		struct usb_hub_descriptor	*desc

In drivers/usb/core/hub.h

130  	struct usb_hub_descriptor {
131  		__u8  bDescLength;
132  		__u8  bDescriptorType;
133  		__u8  bNbrPorts;
134  		__u16 wHubCharacteristics;
135  		__u8  bPwrOn2PwrGood;
136  		__u8  bHubContrCurrent;
137  		    	/* add 1 bit for hub status change; round to bytes */
138  		__u8  DeviceRemovable[(USB_MAXCHILDREN + 1 + 7) / 8];
139  		__u8  PortPwrCtrlMask[(USB_MAXCHILDREN + 1 + 7) / 8];
140  	} __attribute__ ((packed));

In include/linux/usb.h

306  	#define USB_MAXCHILDREN		(16)

This defect was found automatically by Coverity Prevent, a static analysis
tool.

(akpm: this code should be shot.  Field `bitmap' doesn't exist in struct
usb_hub_descriptor.  And this .c file is #included in
drivers/usb/host/ohci-hcd.c, and someone somewhere #defines `bitmap' to
`DeviceRemovable'.

>From a maintainability POV it would be better to memset the whole array
beforehand - I changed the patch to do that)

Signed-off-by: Zaur Kambarov <zkambarov@coverity.com>
Cc: <linux-usb-devel@lists.sourceforge.net?
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
2005-07-12 11:52:56 -07:00
..
ehci-dbg.c [PATCH] USB: misc ehci updates 2005-06-27 14:43:55 -07:00
ehci-hcd.c [PATCH] USB: Fix kmalloc's flags type in USB 2005-07-12 11:52:56 -07:00
ehci-hub.c [PATCH] USB: misc ehci updates 2005-06-27 14:43:55 -07:00
ehci-mem.c [PATCH] USB: kfree cleanup for drivers/usb/* - no need to check for NULL 2005-04-18 17:39:34 -07:00
ehci-q.c [PATCH] USB: Fix kmalloc's flags type in USB 2005-07-12 11:52:56 -07:00
ehci-sched.c [PATCH] USB: Fix kmalloc's flags type in USB 2005-07-12 11:52:56 -07:00
ehci.h [PATCH] USB: ehci power fixes 2005-05-03 23:31:49 -07:00
hc_crisv10.c [PATCH] USB: Fix kmalloc's flags type in USB 2005-07-12 11:52:56 -07:00
hc_crisv10.h Linux-2.6.12-rc2 2005-04-16 15:20:36 -07:00
isp116x-hcd.c [PATCH] USB: Fix kmalloc's flags type in USB 2005-07-12 11:52:56 -07:00
isp116x.h [PATCH] USB: Add isp116x-hcd USB host controller driver 2005-06-27 14:43:42 -07:00
Kconfig [PATCH] USB: Add isp116x-hcd USB host controller driver 2005-06-27 14:43:42 -07:00
Makefile [PATCH] USB: Add isp116x-hcd USB host controller driver 2005-06-27 14:43:42 -07:00
ohci-au1xxx.c Linux-2.6.12-rc2 2005-04-16 15:20:36 -07:00
ohci-dbg.c [PATCH] USB: move the usb hcd code to use the new class code. 2005-06-20 15:15:07 -07:00
ohci-hcd.c [PATCH] USB: Fix kmalloc's flags type in USB 2005-07-12 11:52:56 -07:00
ohci-hub.c [PATCH] USB: coverity: (desc->bitmap)[] overrun fix 2005-07-12 11:52:56 -07:00
ohci-lh7a404.c Linux-2.6.12-rc2 2005-04-16 15:20:36 -07:00
ohci-mem.c [PATCH] USB: Fix kmalloc's flags type in USB 2005-07-12 11:52:56 -07:00
ohci-omap.c [PATCH] ohci-omap, sl811, dummy: remove hub_set_power_budget 2005-06-27 14:43:49 -07:00
ohci-pci.c [PATCH] ppc32: Remove CONFIG_PMAC_PBOOK 2005-06-27 15:11:43 -07:00
ohci-ppc-soc.c Linux-2.6.12-rc2 2005-04-16 15:20:36 -07:00
ohci-pxa27x.c [PATCH] USB: fix up remaining pm_message_t usages 2005-04-18 17:39:24 -07:00
ohci-q.c [PATCH] USB: OHCI on Compaq Aramada 7400 2005-04-18 17:39:30 -07:00
ohci-sa1111.c Linux-2.6.12-rc2 2005-04-16 15:20:36 -07:00
ohci.h [PATCH] ohci-omap, sl811, dummy: remove hub_set_power_budget 2005-06-27 14:43:49 -07:00
sl811_cs.c [PATCH] pcmcia: remove references to pcmcia/version.h 2005-07-07 18:24:07 -07:00
sl811-hcd.c [PATCH] USB: Fix kmalloc's flags type in USB 2005-07-12 11:52:56 -07:00
sl811.h Linux-2.6.12-rc2 2005-04-16 15:20:36 -07:00
uhci-debug.c [PATCH] USB UHCI: Add root hub states 2005-06-27 14:43:43 -07:00
uhci-hcd.c [PATCH] USB UHCI: Detect invalid ports 2005-06-27 14:44:00 -07:00
uhci-hcd.h [PATCH] UHCI: Don't store device pointer in QH or TD 2005-06-27 14:43:48 -07:00
uhci-hub.c [PATCH] USB UHCI: Use root-hub IRQs while suspended 2005-06-27 14:43:44 -07:00
uhci-q.c [PATCH] USB: Fix kmalloc's flags type in USB 2005-07-12 11:52:56 -07:00