]> git.proxmox.com Git - mirror_ubuntu-jammy-kernel.git/commitdiff
IB/hfi1: Use bool in process_ecn
authorDennis Dalessandro <dennis.dalessandro@intel.com>
Sun, 9 Apr 2017 17:17:30 +0000 (10:17 -0700)
committerDoug Ledford <dledford@redhat.com>
Fri, 28 Apr 2017 17:56:24 +0000 (13:56 -0400)
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>
Signed-off-by: Doug Ledford <dledford@redhat.com>
drivers/infiniband/hw/hfi1/hfi.h
drivers/infiniband/hw/hfi1/rc.c

index 9d7c65c7f939029a75acc06ab8ca83cea253f3f4..f06674317abfcd010b192b57ebed503ad59e6e3c 100644 (file)
@@ -1660,7 +1660,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;
 }
index da968b76ba62e67fd1d9e1ba079b047dd37b31b8..9b3333fd9dc0bf31271d9c8f7e834114fb87451a 100644 (file)
@@ -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;