All of lore.kernel.org
 help / color / mirror / Atom feed
From: roel <roel.kluin@gmail.com>
To: FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp>
Cc: James.Bottomley@suse.de, linux-scsi@vger.kernel.org,
	akpm@linux-foundation.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH] osst: wrong index used in inner loop
Date: Mon, 21 Mar 2011 12:00:06 +0100	[thread overview]
Message-ID: <4D872FB6.5000605@gmail.com> (raw)
In-Reply-To: <20110321100300P.fujita.tomonori@lab.ntt.co.jp>

On 21-03-11 02:02, FUJITA Tomonori wrote:
> On Sat, 19 Mar 2011 20:53:53 +0100
> roel <roel.kluin@gmail.com> wrote:
> 
>> Index i was already used in the outer loop.
>>
>> Signed-off-by: Roel Kluin <roel.kluin@gmail.com>
>> ---
>>  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.

Roel

      reply	other threads:[~2011-03-21 11:00 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-03-19 19:53 [PATCH] osst: wrong index used in inner loop roel
2011-03-21  1:02 ` FUJITA Tomonori
2011-03-21 11:00   ` roel [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=4D872FB6.5000605@gmail.com \
    --to=roel.kluin@gmail.com \
    --cc=James.Bottomley@suse.de \
    --cc=akpm@linux-foundation.org \
    --cc=fujita.tomonori@lab.ntt.co.jp \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-scsi@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.