linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [patch] gpio-timberdale: fix a potential wrapping issue
@ 2012-10-11  6:56 Dan Carpenter
  2012-10-12 21:01 ` Linus Walleij
  0 siblings, 1 reply; 3+ messages in thread
From: Dan Carpenter @ 2012-10-11  6:56 UTC (permalink / raw)
  To: Grant Likely; +Cc: Linus Walleij, linux-kernel, kernel-janitors

->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 <dan.carpenter@oracle.com>

diff --git a/drivers/gpio/gpio-timberdale.c b/drivers/gpio/gpio-timberdale.c
index 031c6ad..1a3e2b9 100644
--- a/drivers/gpio/gpio-timberdale.c
+++ b/drivers/gpio/gpio-timberdale.c
@@ -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);
 }

^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [patch] gpio-timberdale: fix a potential wrapping issue
  2012-10-11  6:56 [patch] gpio-timberdale: fix a potential wrapping issue Dan Carpenter
@ 2012-10-12 21:01 ` Linus Walleij
  2012-10-20  3:46   ` Dan Carpenter
  0 siblings, 1 reply; 3+ messages in thread
From: Linus Walleij @ 2012-10-12 21:01 UTC (permalink / raw)
  To: Dan Carpenter; +Cc: Grant Likely, linux-kernel, kernel-janitors

On Thu, Oct 11, 2012 at 8:56 AM, Dan Carpenter <dan.carpenter@oracle.com> wrote:

> ->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 <dan.carpenter@oracle.com>

Applied, thanks!
Should we send this to stable? (I assume so ...)

Yours,
Linus Walleij

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [patch] gpio-timberdale: fix a potential wrapping issue
  2012-10-12 21:01 ` Linus Walleij
@ 2012-10-20  3:46   ` Dan Carpenter
  0 siblings, 0 replies; 3+ messages in thread
From: Dan Carpenter @ 2012-10-20  3:46 UTC (permalink / raw)
  To: Linus Walleij; +Cc: Grant Likely, linux-kernel, kernel-janitors

On Fri, Oct 12, 2012 at 11:01:08PM +0200, Linus Walleij wrote:
> On Thu, Oct 11, 2012 at 8:56 AM, Dan Carpenter <dan.carpenter@oracle.com> wrote:
> 
> > ->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 <dan.carpenter@oracle.com>
> 
> 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


^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2012-10-20  3:46 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-10-11  6:56 [patch] gpio-timberdale: fix a potential wrapping issue Dan Carpenter
2012-10-12 21:01 ` Linus Walleij
2012-10-20  3:46   ` Dan Carpenter

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).