mirror of
https://github.com/apache/nuttx.git
synced 2026-08-01 20:28:58 +00:00
drivers: pci: Fix EPC MSI IRQ map validation
pci_epc_map_msi_irq() used && when checking the EPC pointer and map_msi_irq callback. If epc is NULL, the right-hand side dereferences it; if the callback is NULL on a valid EPC, the guard does not reject it before the call. Match the surrounding EPC wrappers by rejecting a NULL EPC, an out-of-range function number, or a missing map_msi_irq callback before taking the lock and invoking the operation. Generated-by: OpenAI Codex Signed-off-by: Old-Ding <35417409+Old-Ding@users.noreply.github.com>
This commit is contained in:
parent
74c79bbc05
commit
888711ac3c
1 changed files with 2 additions and 1 deletions
|
|
@ -324,7 +324,8 @@ int pci_epc_map_msi_irq(FAR struct pci_epc_ctrl_s *epc, uint8_t funcno,
|
|||
{
|
||||
int ret;
|
||||
|
||||
if (epc == NULL && epc->ops->map_msi_irq == NULL)
|
||||
if (epc == NULL || funcno >= epc->max_functions ||
|
||||
epc->ops->map_msi_irq == NULL)
|
||||
{
|
||||
return -EINVAL;
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue