gpio-timberdale: fix a potential wrapping issue
Subsystems (2)
PATCH 1/1 gpio-timberdale: fix a potential wrapping issue
->last_ier is an unsigned long but the high bits can't be used int the original code because the shift wraps.
Signed-off-by Dan Carpenter <[email protected]>
drivers/gpio/gpio-timberdale.c +2 -2
@@ -116,7 +116,7 @@ static void timbgpio_irq_disable(struct irq_data *d)unsigned long flags;spin_lock_irqsave (&tgpio->lock, flags); - tgpio->last_ier &= ~(1 << offset); + tgpio->last_ier &= ~(1UL << offset);iowrite32 (tgpio->last_ier, tgpio->membase +TGPIO_IER );spin_unlock_irqrestore (&tgpio->lock, flags); }
@@ -128,7 +128,7 @@ static void timbgpio_irq_enable(struct irq_data *d)unsigned long flags;spin_lock_irqsave (&tgpio->lock, flags); - tgpio->last_ier |=1 << offset; + tgpio->last_ier |=1UL << offset;iowrite32 (tgpio->last_ier, tgpio->membase +TGPIO_IER );spin_unlock_irqrestore (&tgpio->lock, flags); }
Linus Walleij
AppliedQuoted 4 lines · Dan Carpenter
->last_ier is an unsigned long but the high bits can't be used int the original code because the shift wraps.
Signed-off-by Dan Carpenter <[email protected]>
Applied, thanks!
Should we send this to stable? (I assume so ...)
Yours,
Linus Walleij
Quoted 9 lines · Linus Walleij
Quoted 4 lines · Dan Carpenter
->last_ier is an unsigned long but the high bits can't be used int the original code because the shift wraps.
Signed-off-by Dan Carpenter <[email protected]>Applied, thanks!
Should we send this to stable? (I assume so ...)
This was a static checker fix. I guess the answer would depend on if there are over 30 IRQs.
regards,
dan carpenter