[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <25e057c00908110154g48241b85td089e6726109b581@mail.gmail.com>
Date: Tue, 11 Aug 2009 10:54:03 +0200
From: roel kluin <roel.kluin@...il.com>
To: Jiri Slaby <jirislaby@...il.com>
Cc: Andrew Morton <akpm@...ux-foundation.org>,
LKML <linux-kernel@...r.kernel.org>
Subject: Re: [PATCH] applicom: Prevent unsigned wrap in ac_interrupt()
>> unsigned i wraps if this occurs in the first iteration.
>
> Could you elaborate? I don't quite understand the point.
`i' is unsigned. The last test in the loop is:
if(readb(apbs[i].RamIO + RAM_IT_TO_PC)) {
/* There's another int waiting on this card */
spin_unlock(&apbs[i].mutex);
i--;
} else {
spin_unlock(&apbs[i].mutex);
}
In the first iteration `i' is 0, so if this condition evaluates to true
then `i' becomes 0xffffffff (since it's unsigned), the for loop test
fails and the i++ never occurs.
>> Or do we know this can't happen?
>
> You mean the i--? It's followed by i++ in the for loop 3rd expression. Or?
No, I meant: do we know the test can't evaluate to true in the first iteration?
Thanks,
Roel
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists