[Skiboot] [PATCH 01/10] core: Bound check get_chip()
Benjamin Herrenschmidt
benh at kernel.crashing.org
Tue Jun 23 14:25:51 AEST 2015
If get_chip() is called with a centaur chipID, return NULL rather
than access beyond an array boundary
Signed-off-by: Benjamin Herrenschmidt <benh at kernel.crashing.org>
---
core/chip.c | 2 ++
1 file changed, 2 insertions(+)
diff --git a/core/chip.c b/core/chip.c
index 7059ec3..00eba41 100644
--- a/core/chip.c
+++ b/core/chip.c
@@ -59,6 +59,8 @@ struct proc_chip *next_chip(struct proc_chip *chip)
struct proc_chip *get_chip(uint32_t chip_id)
{
+ if (chip_id >= MAX_CHIPS)
+ return NULL;
return chips[chip_id];
}
--
2.1.4
More information about the Skiboot
mailing list