diff options
author | Roel Kluin <roel.kluin@gmail.com> | 2009-08-02 04:02:28 -0400 |
---|---|---|
committer | Helge Deller <deller@gmx.de> | 2009-08-02 06:35:28 -0400 |
commit | 447c233da4d109c6194fefd69e5185cbc93cc062 (patch) | |
tree | af44fe8e94480beee7f6e48fe6a527850f1eabce /drivers/parisc/pdc_stable.c | |
parent | b4f2e2ad5348063ef94aa623f6f09b52ecaf0990 (diff) |
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>
Diffstat (limited to 'drivers/parisc/pdc_stable.c')
-rw-r--r-- | drivers/parisc/pdc_stable.c | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/drivers/parisc/pdc_stable.c b/drivers/parisc/pdc_stable.c index f9f9a5f1bbd0..13a64bc081b6 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) | |||
370 | if (!i) /* entry is not ready */ | 370 | if (!i) /* entry is not ready */ |
371 | return -ENODATA; | 371 | return -ENODATA; |
372 | 372 | ||
373 | for (i = 0; devpath->layers[i] && (likely(i < 6)); i++) | 373 | for (i = 0; i < 6 && devpath->layers[i]; i++) |
374 | out += sprintf(out, "%u ", devpath->layers[i]); | 374 | out += sprintf(out, "%u ", devpath->layers[i]); |
375 | 375 | ||
376 | out += sprintf(out, "\n"); | 376 | out += sprintf(out, "\n"); |