Re: [PATCH] osst: wrong index used in inner loop

From: roel
Date: Mon Mar 21 2011 - 07:00:17 EST

On 21-03-11 02:02, FUJITA Tomonori wrote:
> On Sat, 19 Mar 2011 20:53:53 +0100
> roel <roel.kluin@xxxxxxxxx> wrote:
>> Index i was already used in the outer loop.
>> Signed-off-by: Roel Kluin <roel.kluin@xxxxxxxxx>
>> ---
>> drivers/scsi/osst.c | 5 +++--
>> 1 files changed, 3 insertions(+), 2 deletions(-)
>> I'm not sure if this is the right fix, maybe a break or return
>> is missing?
> What are you trying to fix with this patch?

`i' is used as an index in both the outer loop at 4689 and the
inner loop at 4705.

if the UNIT_ATTENTION branch is taken `i' is overwritten after the
loop at 4705 and becomes ST_NBR_PARTITIONS + 1, i.e. 5.

So the loop at 4689 may not loop ten times when the UNIT_ATTENTION
branch is taken. It may loop 5 times or more than ten or hot spin,
dependent how often the UNIT_ATTENTION branch is taken. I'm not
familiar with this driver, but it looked buggy to me.

To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at
Please read the FAQ at