Message ID | 1435033560-9180-1-git-send-email-benh@kernel.crashing.org |
---|---|
State | Accepted |
Headers | show |
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]; }
If get_chip() is called with a centaur chipID, return NULL rather than access beyond an array boundary Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org> --- core/chip.c | 2 ++ 1 file changed, 2 insertions(+)