[PATCH] scsi: isci: fix memcmp casting

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

 



memcmp() returns int, but variable of type u8 is used to store it. When
casting int to u8, one can lose significant bits and get 0 from non-0
value returned by the memcmp().

Signed-off-by: Ivan Bornyakov <brnkv.i1@xxxxxxxxx>
---
 drivers/scsi/isci/host.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/scsi/isci/host.c b/drivers/scsi/isci/host.c
index 1ee3868ade07..dd5f41e86639 100644
--- a/drivers/scsi/isci/host.c
+++ b/drivers/scsi/isci/host.c
@@ -1786,7 +1786,7 @@ static void power_control_timeout(struct timer_list *t)
 				 * them out of await_sas_power state.
 				 */
 				if (requester != NULL && requester != iphy) {
-					u8 other = memcmp(requester->frame_rcvd.iaf.sas_addr,
+					int other = memcmp(requester->frame_rcvd.iaf.sas_addr,
 							  iphy->frame_rcvd.iaf.sas_addr,
 							  sizeof(requester->frame_rcvd.iaf.sas_addr));
 
@@ -1840,7 +1840,7 @@ void sci_controller_power_control_queue_insert(struct isci_host *ihost,
 		struct isci_phy *current_phy;
 
 		for (i = 0; i < SCI_MAX_PHYS; i++) {
-			u8 other;
+			int other;
 			current_phy = &ihost->phys[i];
 
 			other = memcmp(current_phy->frame_rcvd.iaf.sas_addr,
-- 
2.16.1




[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