Linux PARISC architecture development
 help / color / mirror / Atom feed
* [PATCH] kobject: Read buffer overflow
@ 2009-08-02  8:02 Roel Kluin
  2009-08-02 10:06 ` Thibaut VARENE
  2009-08-02 23:33 ` James Bottomley
  0 siblings, 2 replies; 5+ messages in thread
From: Roel Kluin @ 2009-08-02  8:02 UTC (permalink / raw)
  To: kyle, deller, linux-parisc, Andrew Morton

Check whether index is within bounds before testing the element.

Signed-off-by: Roel Kluin <roel.kluin@gmail.com>
---
This also removes the likely, should it be kept?

diff --git a/drivers/parisc/pdc_stable.c b/drivers/parisc/pdc_stable.c
index f9f9a5f..13a64bc 100644
--- a/drivers/parisc/pdc_stable.c
+++ b/drivers/parisc/pdc_stable.c
@@ -370,7 +370,7 @@ pdcspath_layer_read(struct pdcspath_entry *entry, char *buf)
 	if (!i)	/* entry is not ready */
 		return -ENODATA;
 	
-	for (i = 0; devpath->layers[i] && (likely(i < 6)); i++)
+	for (i = 0; i < 6 && devpath->layers[i]; i++)
 		out += sprintf(out, "%u ", devpath->layers[i]);
 
 	out += sprintf(out, "\n");

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

end of thread, other threads:[~2009-08-02 23:33 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2009-08-02  8:02 [PATCH] kobject: Read buffer overflow Roel Kluin
2009-08-02 10:06 ` Thibaut VARENE
2009-08-02 10:16   ` Matthew Wilcox
2009-08-02 10:24     ` Thibaut VARENE
2009-08-02 23:33 ` James Bottomley

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox