public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Peter Senna Tschudin <peter.senna@gmail.com>
To: "Gustavo A. R. Silva" <garsilva@embeddedor.com>
Cc: gregkh@linuxfoundation.org, wsa-dev@sang-engineering.com,
	tj@kernel.org, bhaktipriya96@gmail.com,
	linux-usb@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH] usb: misc: remove unnecessary code
Date: Tue, 21 Feb 2017 23:11:28 +0100	[thread overview]
Message-ID: <20170221221128.GC13525@gmail.com> (raw)
In-Reply-To: <20170220232846.GA5321@embeddedgus>

On Mon, Feb 20, 2017 at 05:28:46PM -0600, Gustavo A. R. Silva wrote:
> 'val' is an unsigned variable, and less-than-zero comparison of an unsigned
> variable is never true.

I would add that val is set by kstrtoul() that converts a string to an
unsigned long.

> 
> Addresses-Coverity-ID: 1230257
Reviewed-by: Peter Senna Tschudin <peter.senna@gmail.com>
> Signed-off-by: Gustavo A. R. Silva <garsilva@embeddedor.com>
> ---
>  drivers/usb/misc/lvstest.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/drivers/usb/misc/lvstest.c b/drivers/usb/misc/lvstest.c
> index c7c2104..6f37610 100644
> --- a/drivers/usb/misc/lvstest.c
> +++ b/drivers/usb/misc/lvstest.c
> @@ -193,7 +193,7 @@ static ssize_t u2_timeout_store(struct device *dev,
>  		return ret;
>  	}
>  
> -	if (val < 0 || val > 127)
> +	if (val > 127)
>  		return -EINVAL;
>  
>  	ret = lvs_rh_set_port_feature(hdev, lvs->portnum | (val << 8),
> -- 
> 2.5.0
> 

  reply	other threads:[~2017-02-21 22:11 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-02-20 23:28 [PATCH] usb: misc: remove unnecessary code Gustavo A. R. Silva
2017-02-21 22:11 ` Peter Senna Tschudin [this message]
2017-02-22  5:35   ` Gustavo A. R. Silva
  -- strict thread matches above, loose matches on Subject: below --
2017-02-16 21:25 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=20170221221128.GC13525@gmail.com \
    --to=peter.senna@gmail.com \
    --cc=bhaktipriya96@gmail.com \
    --cc=garsilva@embeddedor.com \
    --cc=gregkh@linuxfoundation.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-usb@vger.kernel.org \
    --cc=tj@kernel.org \
    --cc=wsa-dev@sang-engineering.com \
    /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