Skip to content

Commit

Permalink
gpio-timberdale: fix a potential wrapping issue
Browse files Browse the repository at this point in the history
->last_ier is an unsigned long but the high bits can't be used int the
original code because the shift wraps.

Cc: stable@kernel.org
Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
  • Loading branch information
Dan Carpenter authored and Linus Walleij committed Oct 15, 2012
1 parent ddffeb8 commit d79550a
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions drivers/gpio/gpio-timberdale.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
Expand All @@ -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);
}
Expand Down

0 comments on commit d79550a

Please sign in to comment.