From patchwork Tue Nov 16 18:15:20 2010 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Eli Cohen X-Patchwork-Id: 328882 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by demeter1.kernel.org (8.14.4/8.14.3) with ESMTP id oAGIDqro014120 for ; Tue, 16 Nov 2010 18:15:13 GMT Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1756403Ab0KPSPM (ORCPT ); Tue, 16 Nov 2010 13:15:12 -0500 Received: from mail-wy0-f174.google.com ([74.125.82.174]:40623 "EHLO mail-wy0-f174.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1756227Ab0KPSPL (ORCPT ); Tue, 16 Nov 2010 13:15:11 -0500 Received: by wyb28 with SMTP id 28so999088wyb.19 for ; Tue, 16 Nov 2010 10:15:07 -0800 (PST) Received: by 10.227.38.143 with SMTP id b15mr8084695wbe.167.1289931306046; Tue, 16 Nov 2010 10:15:06 -0800 (PST) Received: from localhost ([82.166.227.17]) by mx.google.com with ESMTPS id ga16sm965684wbb.1.2010.11.16.10.15.04 (version=TLSv1/SSLv3 cipher=RC4-MD5); Tue, 16 Nov 2010 10:15:04 -0800 (PST) Date: Tue, 16 Nov 2010 20:15:20 +0200 From: Eli Cohen To: Roland Dreier Cc: RDMA list Subject: [PATCH v2] mlx4: properly mask MGM entry members count Message-ID: <20101116181520.GA29609@mtldesk30> MIME-Version: 1.0 Content-Disposition: inline User-Agent: Mutt/1.5.20 (2009-06-14) Sender: linux-rdma-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-rdma@vger.kernel.org X-Greylist: IP, sender and recipient auto-whitelisted, not delayed by milter-greylist-4.2.3 (demeter1.kernel.org [140.211.167.41]); Tue, 16 Nov 2010 18:15:13 +0000 (UTC) diff --git a/drivers/net/mlx4/mcg.c b/drivers/net/mlx4/mcg.c index c4f88b7..5a89631 100644 --- a/drivers/net/mlx4/mcg.c +++ b/drivers/net/mlx4/mcg.c @@ -187,7 +187,7 @@ int mlx4_multicast_attach(struct mlx4_dev *dev, struct mlx4_qp *qp, u8 gid[16], memcpy(mgm->gid, gid, 16); } - members_count = be32_to_cpu(mgm->members_count); + members_count = be32_to_cpu(mgm->members_count) & 0xffffff; if (members_count == MLX4_QP_PER_MGM) { mlx4_err(dev, "MGM at index %x is full.\n", index); err = -ENOMEM; @@ -270,7 +270,7 @@ int mlx4_multicast_detach(struct mlx4_dev *dev, struct mlx4_qp *qp, u8 gid[16]) goto out; } - members_count = be32_to_cpu(mgm->members_count); + members_count = be32_to_cpu(mgm->members_count) & 0xffffff; for (loc = -1, i = 0; i < members_count; ++i) if ((be32_to_cpu(mgm->qp[i]) & MGM_QPN_MASK) == qp->qpn) loc = i;