All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] powerpc: Read buffer overflow
@ 2009-08-03 12:41 Roel Kluin
  2009-08-03 12:57 ` Paul Mackerras
  0 siblings, 1 reply; 5+ messages in thread
From: Roel Kluin @ 2009-08-03 12:41 UTC (permalink / raw)
  To: Andrew Morton, linuxppc-dev, benh

Check whether index is within bounds before grabbing the element.

Signed-off-by: Roel Kluin <roel.kluin@gmail.com>
---
diff --git a/drivers/macintosh/macio_asic.c b/drivers/macintosh/macio_asic.c
index a0f6838..588a5b0 100644
--- a/drivers/macintosh/macio_asic.c
+++ b/drivers/macintosh/macio_asic.c
@@ -294,10 +294,11 @@ static void macio_setup_interrupts(struct macio_dev *dev)
 	int i = 0, j = 0;
 
 	for (;;) {
-		struct resource *res = &dev->interrupt[j];
+		struct resource *res;
 
 		if (j >= MACIO_DEV_COUNT_IRQS)
 			break;
+		res = &dev->interrupt[j];
 		irq = irq_of_parse_and_map(np, i++);
 		if (irq == NO_IRQ)
 			break;
@@ -321,9 +322,10 @@ static void macio_setup_resources(struct macio_dev *dev,
 	int index;
 
 	for (index = 0; of_address_to_resource(np, index, &r) == 0; index++) {
-		struct resource *res = &dev->resource[index];
+		struct resource *res;
 		if (index >= MACIO_DEV_COUNT_RESOURCES)
 			break;
+		res = &dev->resource[index];
 		*res = r;
 		res->name = dev_name(&dev->ofdev.dev);
 

^ permalink raw reply related	[flat|nested] 5+ messages in thread
* [PATCH] powerpc: Read buffer overflow
@ 2009-08-03 11:48 Roel Kluin
  0 siblings, 0 replies; 5+ messages in thread
From: Roel Kluin @ 2009-08-03 11:48 UTC (permalink / raw)
  To: LKML; +Cc: Bernd Petrovitsch, Andrew Morton

Check whether index is within bounds before grabbing the element.

Signed-off-by: Roel Kluin <roel.kluin@gmail.com>
---
diff --git a/drivers/char/hvsi.c b/drivers/char/hvsi.c
index 2989056..793b236 100644
--- a/drivers/char/hvsi.c
+++ b/drivers/char/hvsi.c
@@ -1230,11 +1230,12 @@ static struct tty_driver *hvsi_console_device(struct console *console,
 
 static int __init hvsi_console_setup(struct console *console, char *options)
 {
-	struct hvsi_struct *hp = &hvsi_ports[console->index];
+	struct hvsi_struct *hp;
 	int ret;
 
 	if (console->index < 0 || console->index >= hvsi_count)
 		return -1;
+	hp = &hvsi_ports[console->index];
 
 	/* give the FSP a chance to change the baud rate when we re-open */
 	hvsi_close_protocol(hp);

^ permalink raw reply related	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2009-08-03 20:15 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2009-08-03 12:41 [PATCH] powerpc: Read buffer overflow Roel Kluin
2009-08-03 12:57 ` Paul Mackerras
2009-08-03 13:12   ` Wolfram Sang
2009-08-03 20:15   ` Segher Boessenkool
  -- strict thread matches above, loose matches on Subject: below --
2009-08-03 11:48 Roel Kluin

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.