summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRoel Kluin <roel.kluin@gmail.com>2009-08-02 08:02:28 +0000
committerHelge Deller <deller@gmx.de>2009-08-02 12:35:28 +0200
commit447c233da4d109c6194fefd69e5185cbc93cc062 (patch)
treeaf44fe8e94480beee7f6e48fe6a527850f1eabce
parentb4f2e2ad5348063ef94aa623f6f09b52ecaf0990 (diff)
downloadlinux-3.10-447c233da4d109c6194fefd69e5185cbc93cc062.tar.gz
linux-3.10-447c233da4d109c6194fefd69e5185cbc93cc062.tar.bz2
linux-3.10-447c233da4d109c6194fefd69e5185cbc93cc062.zip
parisc: Fix read buffer overflow in pdc_stable driver
Check whether index is within bounds before testing the element. Signed-off-by: Roel Kluin <roel.kluin@gmail.com> Signed-off-by: Helge Deller <deller@gmx.de>
-rw-r--r--drivers/parisc/pdc_stable.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/drivers/parisc/pdc_stable.c b/drivers/parisc/pdc_stable.c
index f9f9a5f1bbd..13a64bc081b 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");