public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Oliver Neukum <oneukum@suse.com>
To: "Gustavo A. R. Silva" <garsilva@embeddedor.com>,
	stern@rowland.harvard.edu, gregkh@linuxfoundation.org
Cc: linux-usb@vger.kernel.org, usb-storage@lists.one-eyed-alien.net,
	linux-kernel@vger.kernel.org,
	Peter Senna Tschudi <peter.senna@gmail.com>
Subject: Re: [usb-storage] usb: storage: suspicious code
Date: Wed, 15 Feb 2017 08:01:13 +0100	[thread overview]
Message-ID: <1487142073.18610.1.camel@suse.com> (raw)
In-Reply-To: <20170215050652.GA6371@embeddedgus>

Am Dienstag, den 14.02.2017, 23:06 -0600 schrieb Gustavo A. R. Silva:

Hi,

> waitcount = 0;
> do {
>         result = jumpshot_get_status(us);
>         if (result != USB_STOR_TRANSPORT_GOOD) {
>                 // I have not experimented to find the smallest
> value.
>                 //
>                 msleep(50);
>         }
>         } while ((result != USB_STOR_TRANSPORT_GOOD) && (waitcount <
> 10));
> 
>         if (result != USB_STOR_TRANSPORT_GOOD)
>                 usb_stor_dbg(us, "Gah!  Waitcount = 10.  Bad
> write!?\n");
> 
> Variable 'waitcount' is never updated inside the do-while loop. So,
> either it isn't needed at all or line 316 should be modified
> (++waitcount < 10)

you are correct. Waitcount needs to be incremented.

	HTH
		Oliver

  reply	other threads:[~2017-02-15  7:01 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-02-15  5:06 usb: storage: suspicious code Gustavo A. R. Silva
2017-02-15  7:01 ` Oliver Neukum [this message]
2017-02-15  7:14   ` [usb-storage] " Gustavo A. R. Silva
2017-02-15  7:39     ` [PATCH] usb: storage: add missing pre-increment to variable Gustavo A. R. Silva
2017-02-15 15:26       ` [usb-storage] " Alan Stern
2017-02-20 23:07         ` Gustavo A. R. Silva

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=1487142073.18610.1.camel@suse.com \
    --to=oneukum@suse.com \
    --cc=garsilva@embeddedor.com \
    --cc=gregkh@linuxfoundation.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-usb@vger.kernel.org \
    --cc=peter.senna@gmail.com \
    --cc=stern@rowland.harvard.edu \
    --cc=usb-storage@lists.one-eyed-alien.net \
    /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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox