From patchwork Mon Aug 3 13:09:00 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Matan Barak X-Patchwork-Id: 6929551 Return-Path: X-Original-To: patchwork-linux-rdma@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork1.web.kernel.org (Postfix) with ESMTP id 1E0469F358 for ; Mon, 3 Aug 2015 13:11:22 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 163192055D for ; Mon, 3 Aug 2015 13:11:18 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id E13B820567 for ; Mon, 3 Aug 2015 13:11:13 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753820AbbHCNLL (ORCPT ); Mon, 3 Aug 2015 09:11:11 -0400 Received: from [193.47.165.129] ([193.47.165.129]:41026 "EHLO mellanox.co.il" rhost-flags-FAIL-FAIL-OK-FAIL) by vger.kernel.org with ESMTP id S1753825AbbHCNLK (ORCPT ); Mon, 3 Aug 2015 09:11:10 -0400 Received: from Internal Mail-Server by MTLPINE1 (envelope-from matanb@mellanox.com) with ESMTPS (AES256-SHA encrypted); 3 Aug 2015 16:10:48 +0300 Received: from rsws33.mtr.labs.mlnx (dev-r-vrt-064.mtr.labs.mlnx [10.212.64.1]) by labmailer.mlnx (8.13.8/8.13.8) with ESMTP id t73DAlBN030542; Mon, 3 Aug 2015 16:10:47 +0300 From: Matan Barak To: Doug Ledford Cc: linux-rdma@vger.kernel.org, Jason Gunthorpe , Matan Barak , Somnath Kotur , Haggai Eran , Or Gerlitz Subject: [PATCH for-next V1 1/3] IB/core: Access to one past end of array in _gid_table_setup_one Date: Mon, 3 Aug 2015 16:09:00 +0300 Message-Id: <1438607342-11964-2-git-send-email-matanb@mellanox.com> X-Mailer: git-send-email 2.1.0 In-Reply-To: <1438607342-11964-1-git-send-email-matanb@mellanox.com> References: <1438607342-11964-1-git-send-email-matanb@mellanox.com> Sender: linux-rdma-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-rdma@vger.kernel.org X-Spam-Status: No, score=-7.1 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_HI, RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=ham version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP The error flow of _gid_table_setup_one accessed table[port] when port was 1-based instead of 0-based. Squash-into: 'IB/core: Add RoCE GID table management' Signed-off-by: Matan Barak --- drivers/infiniband/core/cache.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/drivers/infiniband/core/cache.c b/drivers/infiniband/core/cache.c index a9d5c70..01b8792 100644 --- a/drivers/infiniband/core/cache.c +++ b/drivers/infiniband/core/cache.c @@ -582,8 +582,9 @@ static int _gid_table_setup_one(struct ib_device *ib_dev) return 0; rollback_table_setup: - for (port = 1; port <= ib_dev->phys_port_cnt; port++) - free_gid_table(ib_dev, port, table[port]); + for (port = 0; port < ib_dev->phys_port_cnt; port++) + free_gid_table(ib_dev, port + rdma_start_port(ib_dev), + table[port]); kfree(table); return err;