Re: [PATCH] scsi: fc: remove redundant check of an unsigned long being less than zero

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On 04/14/2017 06:58 AM, Colin King wrote:
> From: Colin Ian King <colin.king@xxxxxxxxxxxxx>
> 
> 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@xxxxxxxxxxxxx>

Reviewed-by: Tyrel Datwyler <tyreld@xxxxxxxxxxxxxxxxxx>

> ---
>  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
> 

--
To unsubscribe from this list: send the line "unsubscribe kernel-janitors" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html



[Index of Archives]     [Kernel Development]     [Kernel Announce]     [Kernel Newbies]     [Linux Networking Development]     [Share Photos]     [IDE]     [Security]     [Git]     [Netfilter]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Device Mapper]

  Powered by Linux