aboutsummaryrefslogtreecommitdiff
path: root/core/chip.c
diff options
context:
space:
mode:
authorBenjamin Herrenschmidt <benh@kernel.crashing.org>2015-06-23 14:25:51 +1000
committerStewart Smith <stewart@linux.vnet.ibm.com>2015-07-06 17:06:54 +1000
commit559f23b4586cb8918ec242488b6f164d32c0e61a (patch)
tree0ae6924c200735af6f172809953d4866fa1ccdde /core/chip.c
parentf19aaab0e71d83afbe9730312898ad25e33d9296 (diff)
downloadskiboot-559f23b4586cb8918ec242488b6f164d32c0e61a.zip
skiboot-559f23b4586cb8918ec242488b6f164d32c0e61a.tar.gz
skiboot-559f23b4586cb8918ec242488b6f164d32c0e61a.tar.bz2
core: Bound check get_chip()
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> Signed-off-by: Stewart Smith <stewart@linux.vnet.ibm.com>
Diffstat (limited to 'core/chip.c')
-rw-r--r--core/chip.c2
1 files changed, 2 insertions, 0 deletions
diff --git a/core/chip.c b/core/chip.c
index c735df6..f2f1a96 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];
}