mirror of
https://github.com/torvalds/linux.git
synced 2026-05-22 22:22:08 +02:00
net: ipa: don't proceed to out-of-bound write
GCC 12 seems upset that we check ipa_irq against array bound
but then proceed, anyway:
drivers/net/ipa/ipa_interrupt.c: In function ‘ipa_interrupt_add’:
drivers/net/ipa/ipa_interrupt.c:196:27: warning: array subscript 30 is above array bounds of ‘void (*[30])(struct ipa *, enum ipa_irq_id)’ [-Warray-bounds]
196 | interrupt->handler[ipa_irq] = handler;
| ~~~~~~~~~~~~~~~~~~^~~~~~~~~
drivers/net/ipa/ipa_interrupt.c:42:27: note: while referencing ‘handler’
42 | ipa_irq_handler_t handler[IPA_IRQ_COUNT];
| ^~~~~~~
Reviewed-by: Alex Elder <elder@linaro.org>
Link: https://lore.kernel.org/r/20220519004417.2109886-1-kuba@kernel.org
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
This commit is contained in:
parent
dbbc7d04c5
commit
1172aa6e4a
|
|
@ -191,7 +191,8 @@ void ipa_interrupt_add(struct ipa_interrupt *interrupt,
|
|||
struct ipa *ipa = interrupt->ipa;
|
||||
u32 offset;
|
||||
|
||||
WARN_ON(ipa_irq >= IPA_IRQ_COUNT);
|
||||
if (WARN_ON(ipa_irq >= IPA_IRQ_COUNT))
|
||||
return;
|
||||
|
||||
interrupt->handler[ipa_irq] = handler;
|
||||
|
||||
|
|
@ -208,7 +209,8 @@ ipa_interrupt_remove(struct ipa_interrupt *interrupt, enum ipa_irq_id ipa_irq)
|
|||
struct ipa *ipa = interrupt->ipa;
|
||||
u32 offset;
|
||||
|
||||
WARN_ON(ipa_irq >= IPA_IRQ_COUNT);
|
||||
if (WARN_ON(ipa_irq >= IPA_IRQ_COUNT))
|
||||
return;
|
||||
|
||||
/* Update the IPA interrupt mask to disable it */
|
||||
interrupt->enabled &= ~BIT(ipa_irq);
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user