diff options
author | Stewart Smith <stewart@linux.ibm.com> | 2019-06-03 17:41:21 +1000 |
---|---|---|
committer | Stewart Smith <stewart@linux.ibm.com> | 2019-06-04 13:33:04 +1000 |
commit | a66f5a81000dd8efcdcae8f4a996e185d0701c49 (patch) | |
tree | 0ef1078634ace79f33875aafabc1c2f9713cd446 /hw/lpc.c | |
parent | 6995f7d1309d272a2cc59854e20f9df54acf4c6a (diff) | |
download | skiboot-a66f5a81000dd8efcdcae8f4a996e185d0701c49.zip skiboot-a66f5a81000dd8efcdcae8f4a996e185d0701c49.tar.gz skiboot-a66f5a81000dd8efcdcae8f4a996e185d0701c49.tar.bz2 |
hw/lpc: Fix theoretical possible out-of-bounds-read
number of elements versus starting counting from 0.
Found by static analysis.
Signed-off-by: Stewart Smith <stewart@linux.ibm.com>
Diffstat (limited to 'hw/lpc.c')
-rw-r--r-- | hw/lpc.c | 4 |
1 files changed, 2 insertions, 2 deletions
@@ -519,7 +519,7 @@ static int64_t lpc_probe_test(struct lpcm *lpc) /* Ensure we can perform a valid lookup in the error table */ idx = LPC_ERROR_IDX(irqstat); - if (idx < 0 || idx > ARRAY_SIZE(lpc_error_table)) { + if (idx < 0 || idx >= ARRAY_SIZE(lpc_error_table)) { prerror("LPC bus error translation failed with status 0x%x\n", irqstat); return OPAL_PARAMETER; @@ -1035,7 +1035,7 @@ static void lpc_dispatch_err_irqs(struct lpcm *lpc, uint32_t irqs) /* Ensure we can perform a valid lookup in the error table */ idx = LPC_ERROR_IDX(irqs); - if (idx < 0 || idx > ARRAY_SIZE(lpc_error_table)) { + if (idx < 0 || idx >= ARRAY_SIZE(lpc_error_table)) { prerror("LPC bus error translation failed with status 0x%x\n", irqs); return; |