kernel-ark/drivers
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
..
acorn
acpi
atm
base
block
bluetooth [NET]: Transform skb_queue_len() binary tests into skb_queue_empty() 2005-07-08 14:57:23 -07:00
cdrom
char drm: fix stupid missing semicolon. 2005-07-10 12:46:19 +10:00
cpufreq
crypto
dio
eisa
fc4
firmware
i2c
ide [PATCH] pcmcia: remove references to pcmcia/version.h 2005-07-07 18:24:07 -07:00
ieee1394 [PATCH] Sync up ieee-1394 2005-07-10 12:23:23 -07:00
infiniband
input
isdn [NET]: Transform skb_queue_len() binary tests into skb_queue_empty() 2005-07-08 14:57:23 -07:00
macintosh
mca
md [PATCH] device-mapper: dm-raid1: Limit bios to size of mirror region 2005-07-07 18:24:11 -07:00
media [PATCH] v4l: LGDT3302 read status fix 2005-07-07 18:24:04 -07:00
message
misc
mmc
mtd Merge master.kernel.org:/pub/scm/linux/kernel/git/tglx/mtd-2.6 2005-07-11 10:18:18 -07:00
net [NET]: Transform skb_queue_len() binary tests into skb_queue_empty() 2005-07-08 14:57:23 -07:00
nubus
oprofile
parisc
parport [PATCH] pcmcia: remove references to pcmcia/version.h 2005-07-07 18:24:07 -07:00
pci
pcmcia [PATCH] yenta: don't depend on CardBus 2005-07-07 18:24:07 -07:00
pnp
s390 [NET]: Transform skb_queue_len() binary tests into skb_queue_empty() 2005-07-08 14:57:23 -07:00
sbus
scsi [PATCH] pcmcia: remove references to pcmcia/version.h 2005-07-07 18:24:07 -07:00
serial [PATCH] pcmcia: remove references to pcmcia/version.h 2005-07-07 18:24:07 -07:00
sh
sn
tc
telephony [PATCH] pcmcia: remove references to pcmcia/version.h 2005-07-07 18:24:07 -07:00
usb [PATCH] USB: coverity: (desc->bitmap)[] overrun fix 2005-07-12 11:52:56 -07:00
video [PATCH] m32r: framebuffer device support 2005-07-07 18:24:11 -07:00
w1
zorro
Kconfig
Makefile