Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 41196179 authored by Axel Lin's avatar Axel Lin Committed by Matthew Garrett
Browse files

intel_pmic_gpio: fix off-by-one value range checking



In pmic_irq_type(), we use gpio as array index for trigger,
thus the valid value range for gpio should be 0 .. NUM_GPIO - 1.

Signed-off-by: default avatarAxel Lin <axel.lin@gmail.com>
Signed-off-by: default avatarMatthew Garrett <mjg@redhat.com>
parent 35f0ce03
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -197,7 +197,7 @@ static int pmic_irq_type(unsigned irq, unsigned type)
	u32 gpio = irq - pg->irq_base;
	unsigned long flags;

	if (gpio > pg->chip.ngpio)
	if (gpio >= pg->chip.ngpio)
		return -EINVAL;

	spin_lock_irqsave(&pg->irqtypes.lock, flags);