mirror of
https://github.com/opnsense/src.git
synced 2026-06-08 16:22:46 -04:00
Clamp ahci max irq's to AHCI_MAX_IRQS
This prevents the possiblity of any overruns on the statically allocated struct irqs field. Differential Revision: D838 MFC after: 2 weeks X-MFC-With: r276012 Sponsored by: Multiplay
This commit is contained in:
parent
55972826f2
commit
a12f5777df
1 changed files with 8 additions and 0 deletions
|
|
@ -356,6 +356,14 @@ ahci_setup_interrupt(device_t dev)
|
|||
device_printf(dev, "Falling back to one MSI\n");
|
||||
ctlr->numirqs = 1;
|
||||
}
|
||||
|
||||
/* Ensure we don't overrun irqs. */
|
||||
if (ctlr->numirqs > AHCI_MAX_IRQS) {
|
||||
device_printf(dev, "Too many irqs %d > %d (clamping)\n",
|
||||
ctlr->numirqs, AHCI_MAX_IRQS);
|
||||
ctlr->numirqs = AHCI_MAX_IRQS;
|
||||
}
|
||||
|
||||
/* Allocate all IRQs. */
|
||||
for (i = 0; i < ctlr->numirqs; i++) {
|
||||
ctlr->irqs[i].ctlr = ctlr;
|
||||
|
|
|
|||
Loading…
Reference in a new issue