Re: [usb-storage] usb: storage: suspicious code
From: Oliver Neukum
Date: Wed Feb 15 2017 - 02:01:45 EST
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