From patchwork Thu Apr 6 22:42:24 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jason Gunthorpe X-Patchwork-Id: 9668523 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 8ABA1602B3 for ; Thu, 6 Apr 2017 22:42:38 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 75D68285EB for ; Thu, 6 Apr 2017 22:42:38 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 6B042285F0; Thu, 6 Apr 2017 22:42:38 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.8 required=2.0 tests=BAYES_00,DKIM_SIGNED, RCVD_IN_DNSWL_HI,T_DKIM_INVALID autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 281F4285EB for ; Thu, 6 Apr 2017 22:42:38 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754743AbdDFWmg (ORCPT ); Thu, 6 Apr 2017 18:42:36 -0400 Received: from quartz.orcorp.ca ([184.70.90.242]:45895 "EHLO quartz.orcorp.ca" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754291AbdDFWmb (ORCPT ); Thu, 6 Apr 2017 18:42:31 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=obsidianresearch.com; s=rsa1; h=References:In-Reply-To:Message-Id:Date:Subject:Cc:To:From; bh=6iUvDpQLOFgN+fHJxAJR2O5kVotTB5+oGqP3h9UcIa0=; b=wrr6kWHO3BPUWOWqqYrCryCfBhclVh9+rSFpYA9F69gmqAG0/ZGwVqsy1+iulC2WQ18RCp/apbRXfJf9rrRJoQb6mjmZ+JpGU5BlZW1T8gKVXPlDrlGZ/wWMSJrR9lAUK6YD/ctVrekPpMY09rVPRTY1DLqtDxkxFP9NkCu88xo=; Received: from [10.0.0.156] (helo=jggl.edm.orcorp.ca) by quartz.orcorp.ca with esmtps (TLS1.2:ECDHE_RSA_AES_128_CBC_SHA256:128) (Exim 4.84_2) (envelope-from ) id 1cwG6n-0006qQ-QP; Thu, 06 Apr 2017 16:42:29 -0600 From: Jason Gunthorpe To: linux-rdma@vger.kernel.org Cc: Yishai Hadas Subject: [PATCH rdma-core 5/6] mlx4: Fix incorrect masking of g_mlpath_rqpn Date: Thu, 6 Apr 2017 16:42:24 -0600 Message-Id: <1491518545-14746-6-git-send-email-jgunthorpe@obsidianresearch.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1491518545-14746-1-git-send-email-jgunthorpe@obsidianresearch.com> References: <1491518545-14746-1-git-send-email-jgunthorpe@obsidianresearch.com> X-Broken-Reverse-DNS: no host name found for IP address 10.0.0.156 Sender: linux-rdma-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-rdma@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP Two other places do this math and consensus is that MLX4_CQE_QPN_MASK is in host endian, so this math is wrong. Found by sparse. Signed-off-by: Jason Gunthorpe --- providers/mlx4/cq.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/providers/mlx4/cq.c b/providers/mlx4/cq.c index 01d103d983eb4d..844e4da1305c63 100644 --- a/providers/mlx4/cq.c +++ b/providers/mlx4/cq.c @@ -739,7 +739,7 @@ void __mlx4_cq_clean(struct mlx4_cq *cq, uint32_t qpn, struct mlx4_srq *srq) cqe = get_cqe(cq, prod_index & cq->ibv_cq.cqe); cqe += cqe_inc; if (srq && srq->ext_srq && - be32toh(cqe->g_mlpath_rqpn & MLX4_CQE_QPN_MASK) == srq->verbs_srq.srq_num && + (be32toh(cqe->g_mlpath_rqpn) & MLX4_CQE_QPN_MASK) == srq->verbs_srq.srq_num && !(cqe->owner_sr_opcode & MLX4_CQE_IS_SEND_MASK)) { mlx4_free_srq_wqe(srq, be16toh(cqe->wqe_index)); ++nfreed;