lkml.org 
[lkml]   [2009]   [Aug]   [9]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
DateSun, 09 Aug 2009 22:30:46 +0200
FromJiri Slaby <>
SubjectRe: [PATCH] applicom: Prevent unsigned wrap in ac_interrupt()
On 08/08/2009 05:13 PM, Roel Kluin wrote:
> unsigned i wraps if this occurs in the first iteration.

Could you elaborate? I don't quite understand the point.

> Signed-off-by: Roel Kluin <roel.kluin@gmail.com>
> ---
> Or do we know this can't happen?

You mean the i--? It's followed by i++ in the for loop 3rd expression. Or?

>
> diff --git a/drivers/char/applicom.c b/drivers/char/applicom.c
> index 73a0765..0df3e12 100644
> --- a/drivers/char/applicom.c
> +++ b/drivers/char/applicom.c
> @@ -670,7 +670,7 @@ static irqreturn_t ac_interrupt(int vec, void *dev_instance)
> }
> Dummy = readb(apbs[i].RamIO + VERS);
>
> - if(readb(apbs[i].RamIO + RAM_IT_TO_PC)) {
> + if(i && readb(apbs[i].RamIO + RAM_IT_TO_PC)) {
> /* There's another int waiting on this card */
> spin_unlock(&apbs[i].mutex);
> i--;


\
 
 \ /
  Last update: 2009-08-09 22:33    [from the cache]
©2003-2010