History

irqchip/mchp-eic: Fix error code in mchp_eic_domain_alloc()

If irq_domain_translate_twocell() sets "hwirq" to >= MCHP_EIC_NIRQ (2) then it results in an out of bounds access. The code checks for invalid values, but doesn't set the error code. Return -EINVAL in that case, instead of returning success.

Dan Carpenter committed 11 months ago

Commit 7dbc0d41 parent 55026a91 file · +1 −1Browse files

Unified · Split

drivers/irqchip/irq-mchp-eic.c+1−1
@@ -170,7 +170,7 @@ static int mchp_eic_domain_alloc(struct irq_domain *domain, unsigned int virq, · 169 unmodified lines
170170
171171 ret = irq_domain_translate_twocell(domain, fwspec, &hwirq, &type);
172172 if (ret || hwirq >= MCHP_EIC_NIRQ)
173− return ret;
173+ return ret ?: -EINVAL;
174174
175175 switch (type) {
176176 case IRQ_TYPE_EDGE_RISING: