public inbox for kernel-janitors@vger.kernel.org
 help / color / mirror / Atom feed
From: Tyrel Datwyler <turtle.in.the.kernel@gmail.com>
To: Colin King <colin.king@canonical.com>,
	"James E . J . Bottomley" <jejb@linux.vnet.ibm.com>,
	"Martin K . Petersen" <martin.petersen@oracle.com>,
	linux-scsi@vger.kernel.org
Cc: kernel-janitors@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH] scsi: fc: remove redundant check of an unsigned long being less than zero
Date: Mon, 17 Apr 2017 18:53:02 +0000	[thread overview]
Message-ID: <bc14cba3-5140-0e33-115c-56283b2ec44b@gmail.com> (raw)
In-Reply-To: <20170414135802.6991-1-colin.king@canonical.com>

On 04/14/2017 06:58 AM, Colin King wrote:
> From: Colin Ian King <colin.king@canonical.com>
> 
> The check for an unsigned long being less than zero is always false
> so it is a redundant check and can be removed.
> 
> Detected by static analysis with by PVS-Studio
> 
> Signed-off-by: Colin Ian King <colin.king@canonical.com>

Reviewed-by: Tyrel Datwyler <tyreld@linux.vnet.ibm.com>

> ---
>  drivers/scsi/scsi_transport_fc.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/drivers/scsi/scsi_transport_fc.c b/drivers/scsi/scsi_transport_fc.c
> index 2d753c93e07a..87b8f9d64d9b 100644
> --- a/drivers/scsi/scsi_transport_fc.c
> +++ b/drivers/scsi/scsi_transport_fc.c
> @@ -850,7 +850,7 @@ static int fc_str_to_dev_loss(const char *buf, unsigned long *val)
>  	char *cp;
>  
>  	*val = simple_strtoul(buf, &cp, 0);
> -	if ((*cp && (*cp != '\n')) || (*val < 0))
> +	if (*cp && (*cp != '\n'))
>  		return -EINVAL;
>  	/*
>  	 * Check for overflow; dev_loss_tmo is u32
> 


  reply	other threads:[~2017-04-17 18:53 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-04-14 13:58 [PATCH] scsi: fc: remove redundant check of an unsigned long being less than zero Colin King
2017-04-17 18:53 ` Tyrel Datwyler [this message]
2017-04-19  1:54 ` Martin K. Petersen

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=bc14cba3-5140-0e33-115c-56283b2ec44b@gmail.com \
    --to=turtle.in.the.kernel@gmail.com \
    --cc=colin.king@canonical.com \
    --cc=jejb@linux.vnet.ibm.com \
    --cc=kernel-janitors@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-scsi@vger.kernel.org \
    --cc=martin.petersen@oracle.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