mirror of
https://github.com/opnsense/src.git
synced 2026-06-08 16:22:46 -04:00
Fix an out-of-bounds array access... the irq data for teardown is in two
arrays, as elements 0 and 1 of one array and elements 1 and 2 of the other. Run the loop 0..1 instead of 1..2 and use named constants to offset into one of the arrays. PR: 229508
This commit is contained in:
parent
dbadb01591
commit
333559f2f1
1 changed files with 5 additions and 2 deletions
|
|
@ -134,6 +134,8 @@ static struct resource_spec imx_gpio_spec[] = {
|
|||
{ SYS_RES_IRQ, 1, RF_ACTIVE },
|
||||
{ -1, 0 }
|
||||
};
|
||||
#define FIRST_IRQRES 1
|
||||
#define NUM_IRQRES 2
|
||||
|
||||
/*
|
||||
* Helpers
|
||||
|
|
@ -852,9 +854,10 @@ imx51_gpio_detach(device_t dev)
|
|||
sc = device_get_softc(dev);
|
||||
|
||||
gpiobus_detach_bus(dev);
|
||||
for (irq = 1; irq <= 2; irq++) {
|
||||
for (irq = 0; irq < NUM_IRQRES; irq++) {
|
||||
if (sc->gpio_ih[irq])
|
||||
bus_teardown_intr(dev, sc->sc_res[irq], sc->gpio_ih[irq]);
|
||||
bus_teardown_intr(dev, sc->sc_res[irq + FIRST_IRQRES],
|
||||
sc->gpio_ih[irq]);
|
||||
}
|
||||
bus_release_resources(dev, imx_gpio_spec, sc->sc_res);
|
||||
mtx_destroy(&sc->sc_mtx);
|
||||
|
|
|
|||
Loading…
Reference in a new issue