linux-rdma.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Dennis Dalessandro <dennis.dalessandro@intel.com>
To: dledford@redhat.com
Cc: linux-rdma@vger.kernel.org,
	Mike Marciniszyn <mike.marciniszyn@intel.com>,
	stable@vger.kernel.org
Subject: [PATCH v2 19/19] IB/hfi1: Use bool in process_ecn
Date: Fri, 28 Apr 2017 10:40:47 -0700	[thread overview]
Message-ID: <20170428174047.23960.61709.stgit@scvm10.sc.intel.com> (raw)
In-Reply-To: <20170428173443.23960.32602.stgit@scvm10.sc.intel.com>

The process_ecn intends to return a bool value. However it is doing
so incorrectly by ANDing the fecn mask. The fecn bit is bit 31. Bool is
not a native data type and is up to the compiler to implement how it
sees fit. It is conceivable that this upper bit gets washed out.

Fix by converting to a bool properly.

Cc: stable@vger.kernel.org
Fixes: Commit fd2b562edca6 ("IB/hfi1: Pull FECN/BECN processing to a common place")
Reviewed-by: Mike Marciniszyn <mike.marciniszyn@intel.com>
Signed-off-by: Dennis Dalessandro <dennis.dalessandro@intel.com>
---
 drivers/infiniband/hw/hfi1/hfi.h |    2 +-
 drivers/infiniband/hw/hfi1/rc.c  |    3 ++-
 2 files changed, 3 insertions(+), 2 deletions(-)

diff --git a/drivers/infiniband/hw/hfi1/hfi.h b/drivers/infiniband/hw/hfi1/hfi.h
index fec6eb6..51fffdf 100644
--- a/drivers/infiniband/hw/hfi1/hfi.h
+++ b/drivers/infiniband/hw/hfi1/hfi.h
@@ -1609,7 +1609,7 @@ static inline bool process_ecn(struct rvt_qp *qp, struct hfi1_packet *pkt,
 	bth1 = be32_to_cpu(ohdr->bth[1]);
 	if (unlikely(bth1 & (IB_BECN_SMASK | IB_FECN_SMASK))) {
 		hfi1_process_ecn_slowpath(qp, pkt, do_cnp);
-		return bth1 & IB_FECN_SMASK;
+		return !!(bth1 & IB_FECN_SMASK);
 	}
 	return false;
 }
diff --git a/drivers/infiniband/hw/hfi1/rc.c b/drivers/infiniband/hw/hfi1/rc.c
index da968b7..9b3333f 100644
--- a/drivers/infiniband/hw/hfi1/rc.c
+++ b/drivers/infiniband/hw/hfi1/rc.c
@@ -1930,7 +1930,8 @@ void hfi1_rc_rcv(struct hfi1_packet *packet)
 	int diff;
 	struct ib_reth *reth;
 	unsigned long flags;
-	int ret, is_fecn = 0;
+	int ret;
+	bool is_fecn = false;
 	bool copy_last = false;
 	u32 rkey;
 

      parent reply	other threads:[~2017-04-28 17:40 UTC|newest]

Thread overview: 20+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-04-28 17:38 [PATCH v2 00/19] IB/hfi1,rdmavt,core: Patches for-next Dennis Dalessandro
2017-04-28 17:39 ` [PATCH v2 03/19] IB/core: For multicast functions, verify that LIDs are multicast LIDs Dennis Dalessandro
     [not found] ` <20170428173443.23960.32602.stgit-9QXIwq+3FY+1XWohqUldA0EOCMrvLtNR@public.gmane.org>
2017-04-28 17:38   ` [PATCH v2 01/19] IB/core: If the MGID/MLID pair is not on the list return an error Dennis Dalessandro
2017-04-28 17:39   ` [PATCH v2 02/19] IB/hfi1: Correct MulticastMask/CollectiveMask info to SMA output Dennis Dalessandro
2017-04-28 17:39   ` [PATCH v2 04/19] IB/rdmavt/hfi1/qib: Use the MGID and MLID for multicast addressing Dennis Dalessandro
2017-04-28 17:39   ` [PATCH v2 05/19] IB/hfi1: Validate the TID count before using it Dennis Dalessandro
2017-04-28 17:39   ` [PATCH v2 06/19] IB/hfi1: Return SC2VL mappings to FM with VL15 instead of ILLEGAL_VL Dennis Dalessandro
2017-04-28 17:39   ` [PATCH v2 07/19] IB/hfi1: Rename hdr2sc to hfi1_9B_get_sc5 Dennis Dalessandro
2017-04-28 17:39   ` [PATCH v2 08/19] IB/hfi1: Add functions to parse 9B headers Dennis Dalessandro
2017-04-28 17:39   ` [PATCH v2 09/19] IB/hfi1: Use defines from common headers Dennis Dalessandro
2017-04-28 17:39   ` [PATCH v2 10/19] IB/hfi1: Prevent kernel QP post send hard lockups Dennis Dalessandro
2017-04-28 17:40   ` [PATCH v2 11/19] IB/hfi1: Fix softlockup issue Dennis Dalessandro
2017-04-28 17:40   ` [PATCH v2 12/19] IB/hfi1: Adjust high temperature warning for QSFP cable Dennis Dalessandro
2017-04-28 17:40   ` [PATCH v2 13/19] IB/hfi1: Cache neighbor secure data after link up Dennis Dalessandro
2017-04-28 17:40   ` [PATCH v2 14/19] IB/hfi1: Permanently enable P_Key checking in HFI Dennis Dalessandro
2017-04-28 17:40   ` [PATCH v2 15/19] IB/hfi1: Fix misspelling in comment Dennis Dalessandro
2017-04-28 17:40   ` [PATCH v2 16/19] IB/hfi1: Convert %Lx to %llx Dennis Dalessandro
2017-04-28 17:40   ` [PATCH v2 17/19] IB/hfi1: Fix unbalanced braces around else Dennis Dalessandro
2017-04-28 17:40   ` [PATCH v2 18/19] IB/hfi: Protect against writable mmap Dennis Dalessandro
2017-04-28 17:40 ` Dennis Dalessandro [this message]

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=20170428174047.23960.61709.stgit@scvm10.sc.intel.com \
    --to=dennis.dalessandro@intel.com \
    --cc=dledford@redhat.com \
    --cc=linux-rdma@vger.kernel.org \
    --cc=mike.marciniszyn@intel.com \
    --cc=stable@vger.kernel.org \
    /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;
as well as URLs for NNTP newsgroup(s).