[patch -next] scsi_transport_fc: remove unneeded check

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

 



"val" can never be less than zero here.  It's unsigned and
simple_strtoul() always returns positive values.

I also cleaned up the check.  "*cp != '\0'" is more explicit than "*cp"
and I removed some parenthesis that weren't needed.

Signed-off-by: Dan Carpenter <error27@xxxxxxxxx>
---
I sent this patch some months back but didn't recieve any feedback.

diff --git a/drivers/scsi/scsi_transport_fc.c b/drivers/scsi/scsi_transport_fc.c
index 0681378..b108a9b 100644
--- a/drivers/scsi/scsi_transport_fc.c
+++ b/drivers/scsi/scsi_transport_fc.c
@@ -844,7 +844,7 @@ store_fc_rport_dev_loss_tmo(struct device *dev, struct device_attribute *attr,
 	    (rport->port_state == FC_PORTSTATE_NOTPRESENT))
 		return -EBUSY;
 	val = simple_strtoul(buf, &cp, 0);
-	if ((*cp && (*cp != '\n')) || (val < 0))
+	if (*cp != '\0' && *cp != '\n')
 		return -EINVAL;
 
 	/*

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


[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [SCSI Target Devel]     [Linux SCSI Target Infrastructure]     [Kernel Newbies]     [IDE]     [Security]     [Git]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux ATA RAID]     [Linux IIO]     [Samba]     [Device Mapper]
  Powered by Linux