Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1581402

Re: [usb-storage] [PATCH] usb: storage: add missing pre-increment to variable

From Alan Stern <stern@rowland.harvard.edu>
Newsgroups linux.kernel
Subject Re: [usb-storage] [PATCH] usb: storage: add missing pre-increment to variable
Date 2017-02-15 16:30 +0100
Message-ID <tb9GP-1II-37@gated-at.bofh.it> (permalink)
References <tb2OZ-5Ei-9@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw


On Wed, 15 Feb 2017, Gustavo A. R. Silva wrote:

> Add missing pre-increment to 'waitcount' variable used in do-while loop.
> 
> Addresses-Coverity-ID: 1011631
> Signed-off-by: Gustavo A. R. Silva <garsilva@embeddedor.com>
> ---
>  drivers/usb/storage/jumpshot.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/drivers/usb/storage/jumpshot.c b/drivers/usb/storage/jumpshot.c
> index 011e527..a26c4bb 100644
> --- a/drivers/usb/storage/jumpshot.c
> +++ b/drivers/usb/storage/jumpshot.c
> @@ -313,7 +313,7 @@ static int jumpshot_write_data(struct us_data *us,
>  				//
>  				msleep(50); 
>  			}
> -		} while ((result != USB_STOR_TRANSPORT_GOOD) && (waitcount < 10));
> +		} while ((result != USB_STOR_TRANSPORT_GOOD) && (++waitcount < 10));
>  
>  		if (result != USB_STOR_TRANSPORT_GOOD)
>  			usb_stor_dbg(us, "Gah!  Waitcount = 10.  Bad write!?\n");
> 

This has already been reported and fixed.  See

	http://marc.info/?l=linux-usb&m=148604164024557&w=2

Alan Stern

Back to linux.kernel | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

usb: storage: suspicious code "Gustavo A. R. Silva" <garsilva@embeddedor.com> - 2017-02-15 06:10 +0100
  Re: [usb-storage] usb: storage: suspicious code Oliver Neukum <oneukum@suse.com> - 2017-02-15 08:10 +0100
    Re: [usb-storage] usb: storage: suspicious code "Gustavo A. R. Silva" <garsilva@embeddedor.com> - 2017-02-15 08:50 +0100
      [PATCH] usb: storage: add missing pre-increment to variable "Gustavo A. R. Silva" <garsilva@embeddedor.com> - 2017-02-15 09:10 +0100
        Re: [usb-storage] [PATCH] usb: storage: add missing pre-increment  to variable Alan Stern <stern@rowland.harvard.edu> - 2017-02-15 16:30 +0100
          Re: [usb-storage] [PATCH] usb: storage: add missing pre-increment  to variable "Gustavo A. R. Silva" <garsilva@embeddedor.com> - 2017-02-21 00:40 +0100

csiph-web