[PATCH] scsi: isci: fix memcmp casting

From: Ivan Bornyakov
Date: Thu May 24 2018 - 12:12:51 EST


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