Skip to contentSkip to conversation

in pcmcia: use struct resource for PCMCIA devices, part 2

BUG -next Christoph Fritz 2 participants 3 messages Aug 2, 2010 – Aug 3, 2010

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

Hi,

buffer overflow in next-tree's commit 810654b4119fd8c6ce03ffeb4b78f0ff8ffe0559

drivers/pcmcia/ds.c
555 for (i = 0; i < (MAX_IO_WIN + MAX_WIN); i++) {
556 c->io[i].name = p_dev->devname;

with 'io' only defined to MAX_IO_WIN

drivers/pcmcia/cs_internal.h
42 struct resource io[MAX_IO_WIN]; /* io ports */

non-tested fix:

drivers/pcmcia/cs_internal.h +1 -1
index da055dc..d14c6ec 100644
@@ -39,7 +39,7 @@ typedef struct config_t {
 	unsigned char	Status, Pin, Copy, Option, ExtStatus;
 	unsigned int	CardValues;
 
-	struct resource io[MAX_IO_WIN]; /* io ports */
+	struct resource io[MAX_IO_WIN + MAX_WIN]; /* io ports */
 	struct resource mem[MAX_WIN];   /* mem areas */
 
 	struct {
#1 lore raw

Hey,

Quoted 8 lines · Christoph Fritz

drivers/pcmcia/ds.c
555 for (i = 0; i < (MAX_IO_WIN + MAX_WIN); i++) {
556 c->io[i].name = p_dev->devname;

with 'io' only defined to MAX_IO_WIN

drivers/pcmcia/cs_internal.h
42 struct resource io[MAX_IO_WIN]; /* io ports */

Yes, this is ugly (and will be fixed right now), but it isn't really a bug, for we want c->mem[i].name to be set too, and c->mem[] follows immediately c->io[] and is sufficientyly large.

Best,
Dominik

#2 lore raw
Quoted 7 lines · Dominik Brodowski

Hey,

Quoted 4 lines · Christoph Fritz

drivers/pcmcia/ds.c
555 for (i = 0; i < (MAX_IO_WIN + MAX_WIN); i++) {
556 c->io[i].name = p_dev->devname;

Quoted 8 lines
Quoted 4 lines

with 'io' only defined to MAX_IO_WIN

drivers/pcmcia/cs_internal.h
42 struct resource io[MAX_IO_WIN]; /* io ports */

Yes, this is ugly (and will be fixed right now), but it isn't really a bug, for we want c->mem[i].name to be set too, and c->mem[] follows immediately c->io[] and is sufficientyly large.

ah I see ;-)

thanks,
chf