From patchwork Thu Aug 6 17:13:57 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Matan Barak X-Patchwork-Id: 6961511 Return-Path: X-Original-To: patchwork-linux-rdma@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork2.web.kernel.org (Postfix) with ESMTP id BFADCC05AC for ; Thu, 6 Aug 2015 17:16:21 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id E56E62071C for ; Thu, 6 Aug 2015 17:16:19 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 2FEEB2070E for ; Thu, 6 Aug 2015 17:16:15 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753217AbbHFRQO (ORCPT ); Thu, 6 Aug 2015 13:16:14 -0400 Received: from [193.47.165.129] ([193.47.165.129]:42742 "EHLO mellanox.co.il" rhost-flags-FAIL-FAIL-OK-FAIL) by vger.kernel.org with ESMTP id S1753341AbbHFRQN (ORCPT ); Thu, 6 Aug 2015 13:16:13 -0400 Received: from Internal Mail-Server by MTLPINE1 (envelope-from matanb@mellanox.com) with ESMTPS (AES256-SHA encrypted); 6 Aug 2015 20:15:42 +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 t76HFgFa016561; Thu, 6 Aug 2015 20:15:42 +0300 From: Matan Barak To: Doug Ledford Cc: linux-rdma@vger.kernel.org, Jason Gunthorpe , Or Gerlitz , Matan Barak , Haggai Eran , Somnath Kotur Subject: [PATCH for-next V2 1/4] IB/core: Access to one past end of array in _gid_table_setup_one Date: Thu, 6 Aug 2015 20:13:57 +0300 Message-Id: <1438881240-22790-2-git-send-email-matanb@mellanox.com> X-Mailer: git-send-email 2.1.0 In-Reply-To: <1438881240-22790-1-git-send-email-matanb@mellanox.com> References: <1438881240-22790-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.0 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;