Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > linux.kernel > #1623670 > unrolled thread
| Started by | Colin King <colin.king@canonical.com> |
|---|---|
| First post | 2017-04-14 16:00 +0200 |
| Last post | 2017-04-19 04:00 +0200 |
| Articles | 3 — 3 participants |
Back to article view | Back to linux.kernel
[PATCH] scsi: fc: remove redundant check of an unsigned long being less than zero Colin King <colin.king@canonical.com> - 2017-04-14 16:00 +0200
Re: [PATCH] scsi: fc: remove redundant check of an unsigned long being less than zero Tyrel Datwyler <turtle.in.the.kernel@gmail.com> - 2017-04-17 21:00 +0200
Re: [PATCH] scsi: fc: remove redundant check of an unsigned long being less than zero "Martin K. Petersen" <martin.petersen@oracle.com> - 2017-04-19 04:00 +0200
| From | Colin King <colin.king@canonical.com> |
|---|---|
| Date | 2017-04-14 16:00 +0200 |
| Subject | [PATCH] scsi: fc: remove redundant check of an unsigned long being less than zero |
| Message-ID | <tw9Vw-1JY-3@gated-at.bofh.it> |
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
[toc] | [next] | [standalone]
| From | Tyrel Datwyler <turtle.in.the.kernel@gmail.com> |
|---|---|
| Date | 2017-04-17 21:00 +0200 |
| Subject | Re: [PATCH] scsi: fc: remove redundant check of an unsigned long being less than zero |
| Message-ID | <txk2u-4d7-21@gated-at.bofh.it> |
| In reply to | #1623670 |
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 >
[toc] | [prev] | [next] | [standalone]
| From | "Martin K. Petersen" <martin.petersen@oracle.com> |
|---|---|
| Date | 2017-04-19 04:00 +0200 |
| Message-ID | <txN4t-5t3-1@gated-at.bofh.it> |
| In reply to | #1623670 |
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
[toc] | [prev] | [standalone]
Back to top | Article view | linux.kernel
csiph-web