From: Ivan Bornyakov <brnkv.i1@gmail.com>
To: intel-linux-scu@intel.com
Cc: artur.paszkiewicz@intel.com, jejb@linux.vnet.ibm.com,
martin.petersen@oracle.com, linux-scsi@vger.kernel.org,
linux-kernel@vger.kernel.org, Ivan Bornyakov <brnkv.i1@gmail.com>
Subject: [PATCH] scsi: isci: fix memcmp casting
Date: Thu, 24 May 2018 20:06:28 +0300 [thread overview]
Message-ID: <20180524170628.24204-1-brnkv.i1@gmail.com> (raw)
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@gmail.com>
---
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
reply other threads:[~2018-05-24 17:05 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20180524170628.24204-1-brnkv.i1@gmail.com \
--to=brnkv.i1@gmail.com \
--cc=artur.paszkiewicz@intel.com \
--cc=intel-linux-scu@intel.com \
--cc=jejb@linux.vnet.ibm.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-scsi@vger.kernel.org \
--cc=martin.petersen@oracle.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®