* [PATCH] scsi: fc: remove redundant check of an unsigned long being less than zero
@ 2017-04-14 13:58 Colin King
2017-04-17 18:53 ` Tyrel Datwyler
2017-04-19 1:54 ` Martin K. Petersen
0 siblings, 2 replies; 3+ messages in thread
From: Colin King @ 2017-04-14 13:58 UTC (permalink / raw)
To: James E . J . Bottomley, Martin K . Petersen, linux-scsi
Cc: kernel-janitors, linux-kernel
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>
---
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
--
2.11.0
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH] scsi: fc: remove redundant check of an unsigned long being less than zero
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
2017-04-19 1:54 ` Martin K. Petersen
1 sibling, 0 replies; 3+ messages in thread
From: Tyrel Datwyler @ 2017-04-17 18:53 UTC (permalink / raw)
To: Colin King, James E . J . Bottomley, Martin K . Petersen, linux-scsi
Cc: kernel-janitors, linux-kernel
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
>
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH] scsi: fc: remove redundant check of an unsigned long being less than zero
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
@ 2017-04-19 1:54 ` Martin K. Petersen
1 sibling, 0 replies; 3+ messages in thread
From: Martin K. Petersen @ 2017-04-19 1:54 UTC (permalink / raw)
To: Colin King
Cc: James E . J . Bottomley, Martin K . Petersen, linux-scsi,
kernel-janitors, linux-kernel
Colin King <colin.king@canonical.com> writes:
> The check for an unsigned long being less than zero is always false so
> it is a redundant check and can be removed.
Applied to 4.12/scsi-queue.
--
Martin K. Petersen Oracle Linux Engineering
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2017-04-19 1:54 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
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
2017-04-19 1:54 ` Martin K. Petersen
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).