From patchwork Mon Nov 21 18:21:17 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bart Van Assche X-Patchwork-Id: 9439917 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 B822F60469 for ; Mon, 21 Nov 2016 18:21:30 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id A101D28755 for ; Mon, 21 Nov 2016 18:21:30 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 94B1A2876A; Mon, 21 Nov 2016 18:21:30 +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 D37A528755 for ; Mon, 21 Nov 2016 18:21:29 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754107AbcKUSV2 (ORCPT ); Mon, 21 Nov 2016 13:21:28 -0500 Received: from mail-by2nam03on0048.outbound.protection.outlook.com ([104.47.42.48]:24384 "EHLO NAM03-BY2-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1753990AbcKUSV1 (ORCPT ); Mon, 21 Nov 2016 13:21:27 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sandiskcorp.onmicrosoft.com; s=selector1-sandisk-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version; bh=qn5zOnwFsaYH6n4tEeH6M+JBnhxDZzI5GtjtqLJ17B8=; b=GjmITlfHGEwkkCin5bdYtRIe2zDUHIRYgCXN+naQ9aMqpbqUACNJWo0Ey1B4AEW42zfzY3wlFUbHPTLY7b2BkS3q8Uu8c2H2Mz8ta540ufT94b2fNEVhyd4relgWptkFau5eUO2cJ6dminsnTEBsuq/0Kxkq/wGJhHSyw48WEws= Received: from BN6PR02CA0042.namprd02.prod.outlook.com (10.173.146.156) by CY4PR02MB2855.namprd02.prod.outlook.com (10.175.60.137) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384_P384) id 15.1.734.8; Mon, 21 Nov 2016 18:21:25 +0000 Received: from BL2FFO11OLC010.protection.gbl (2a01:111:f400:7c09::165) by BN6PR02CA0042.outlook.office365.com (2603:10b6:404:5f::28) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384_P384) id 15.1.734.8 via Frontend Transport; Mon, 21 Nov 2016 18:21:24 +0000 Authentication-Results: spf=pass (sender IP is 63.163.107.225) smtp.mailfrom=sandisk.com; vger.kernel.org; dkim=none (message not signed) header.d=none;vger.kernel.org; dmarc=bestguesspass action=none header.from=sandisk.com; Received-SPF: Pass (protection.outlook.com: domain of sandisk.com designates 63.163.107.225 as permitted sender) receiver=protection.outlook.com; client-ip=63.163.107.225; helo=milsmgep14.sandisk.com; Received: from milsmgep14.sandisk.com (63.163.107.225) by BL2FFO11OLC010.mail.protection.outlook.com (10.173.160.154) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384_P384) id 15.1.721.5 via Frontend Transport; Mon, 21 Nov 2016 18:21:23 +0000 X-IncomingTopHeaderMarker: OriginalChecksum:; UpperCasedChecksum:; SizeAsReceived:2905; Count:19 Received: from MILHUBIP03.sdcorp.global.sandisk.com (Unknown_Domain [10.201.67.162]) (using TLS with cipher DHE-RSA-AES256-SHA (256/256 bits)) (Client did not present a certificate) by (Symantec Messaging Gateway) with SMTP id E0.42.03811.86933385; Mon, 21 Nov 2016 10:14:03 -0800 (PST) Received: from milsmgip11.sandisk.com (10.177.8.100) by MILHUBIP03.sdcorp.global.sandisk.com (10.177.9.96) with Microsoft SMTP Server id 14.3.319.2; Mon, 21 Nov 2016 10:21:20 -0800 X-AuditID: 0ac94371-71bff70000000ee3-a0-583339685dcc Received: from exp-402881.sandisk.com ( [10.177.9.6]) by (Symantec Messaging Gateway) with SMTP id 0B.CA.02804.D1B33385; Mon, 21 Nov 2016 10:21:19 -0800 (PST) Subject: [PATCH 1/3] IB/mad: Fix an array index check To: Doug Ledford References: <94eb11fc-b558-b994-c933-da784caefc53@sandisk.com> CC: "linux-rdma@vger.kernel.org" , Sean Hefty From: Bart Van Assche Message-ID: <396b3fe2-6a84-efed-07de-3e6381009ad1@sandisk.com> Date: Mon, 21 Nov 2016 10:21:17 -0800 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:45.0) Gecko/20100101 Thunderbird/45.4.0 MIME-Version: 1.0 In-Reply-To: <94eb11fc-b558-b994-c933-da784caefc53@sandisk.com> X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFnrALMWRmVeSWpSXmKPExsXCddJ5kW62pXGEwdajYhYvz39gtXh2qJfF onn9BhYHZo/Fe14yebzfd5XN4/MmuQDmKC6blNSczLLUIn27BK6M+833WAvucla0nbnG2sA4 haOLkZNDQsBEYvaG70xdjFwcQgJLmSQ6vn1ihXB2MEqcuveODabq056JjCC2kMBiRok978JB bGEBU4mLJ/aBxUUE1CQ2vVrEDlFjJ3F8+RGgXg4OZoEkiZkrhEDCbAJGEt/ez2QBCfMClZy7 VQMSZhFQlXj35R4riC0qECGx6escFhCbV0BQ4uTMJ2A2p4C9xJdVp1ghJmpKrN+lDxJmFpCX 2P52DjPIxRICs1glrvS9ZIO4QF3i5JL5TBMYhWchGTULoX0WkvYFjMyrGMVyM3OKc9NTCwxN 9IoT81Iyi7P1kvNzNzFCwr1wB+Pr296HGAU4GJV4eGdwGkcIsSaWFVfmHmKU4GBWEuGdYAUU 4k1JrKxKLcqPLyrNSS0+xCjNwaIkznsx+mOYkEB6YklqdmpqQWoRTJaJg1OqgTE1f7fQlqAL TKwBoT8Thdj+br187M/RZRq/he6yeMoofjeTDZezWsC7WmvxrjmtsszlN68mzt/37HDdg0u+ l25c+P7F6f+qdI8P6s6342x4ZouWpq2SFIybvNfBniG2ynqW6pGW95vU08K+Lxd8VTNlzoo8 PwPhxQuFJpt6fNs8+fz9r27Fk38rsRRnJBpqMRcVJwIA3EB97XMCAAA= X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFrrJJMWRmVeSWpSXmKPExsXCtZGTTVfe2jjC4PxsbYuX5z+wWjw71Mti 0bx+A4sDs8fiPS+ZPN7vu8rm8XmTXABzFJdNSmpOZllqkb5dAlfG/eZ7rAV3OSvazlxjbWCc wtHFyMkhIWAi8WnPRMYuRi4OIYGFjBLXvrQzgySEBUwlLp7YxwhiiwioSWx6tYgdxBYSsJM4 vvwIG4jNLJAkcXlRF5jNJmAk8e39TJYuRg4OXqCac7dqQMIsAqoS777cYwWxRQUiJDZ9ncMC YvMKCEqcnPkEzOYUsJf4suoUK8RIdYk/8y4xQ9jyEtvfzmGewMg3C0nLLCRls5CULWBkXsUo lpuZU5ybnllgaKhXnJiXklmcrZecn7uJERJ4kTsYn040P8TIxMEp1cC48F5e3Z/FQaGbtq5l 53EzbLz1TpbrQIe0x399O1ErZfFt7QnmHLqM7Lpbns6cce+or374XZmbi/1YBV9oiJ+rXR6q vVTukcSa8EKgDg2t/odOzTtnOkX8ePrk2SX53EkiZj7KV65teqmwwnzF121ak16zpaa6NV0I +Si3ncHcZ5vMxbeHwpRYijMSDbWYi4oTAQEaurLsAQAA X-IncomingHeaderCount: 19 X-EOPAttributedMessage: 0 X-MS-Office365-Filtering-HT: Tenant X-Forefront-Antispam-Report: CIP:63.163.107.225; IPV:NLI; CTRY:US; EFV:NLI; SFV:NSPM; SFS:(10009020)(6009001)(7916002)(2980300002)(438002)(189002)(199003)(6916009)(2950100002)(31696002)(8676002)(50986999)(575784001)(38730400001)(86362001)(92566002)(23676002)(68736007)(97736004)(110136003)(65826007)(5660300001)(64126003)(106466001)(4001350100001)(36756003)(305945005)(2906002)(69596002)(77096005)(7846002)(53416004)(189998001)(47776003)(8936002)(65806001)(626004)(356003)(65956001)(2270400002)(76176999)(83506001)(33646002)(81156014)(81166006)(4326007)(230700001)(31686004)(50466002)(87936001)(54356999); DIR:OUT; SFP:1101; SCL:1; SRVR:CY4PR02MB2855; H:milsmgep14.sandisk.com; FPR:; SPF:Pass; PTR:InfoDomainNonexistent; MX:1; A:1; LANG:en; X-Microsoft-Exchange-Diagnostics: 1; BL2FFO11OLC010; 1:rNGiJOWsngTEKAcR6EVgt7ADrh/EbfQ/RqDCmzEUd+CV46fiv8JhEBNQiPQHXE2DDQT7C58ydoD/oMMNzg8vPO57NxI+pvxoVJ5RwQtbMN78QE56YLGaIF/Vg0ZHz5CIEB3r/MR62aPVNQfY2B0j6tRC5H3JIG4/2kEk/q4LLmLwa6/UbnkCdJ5p8NodQr5MuuPI0NGC2vFl4pTj3/oul9u0JQEN+hdA3kiqHrGrYEOCIcppypZCF8SfIFC9+Z/O2R6Ipb2LsiMcItVGfv6hXTanYGYBB3G9SuiypD8TUneWPeBHbRFEHS7PB4cqPY+AATk8zS0/IZhOmy2R3tooF89jIoLsOVnJr+0i8qFaWoafx7y6QzDgBFeqYYvhtgVEo69ud6XTSAslfeNvU8Fk7fQZCinT+LS/6wUSr6OTLZU2R/cMiWc5w2p6faVNMLzbH+QkVkvhNtnzVJ6dxvAtqfX1/T+t7GihiRWjhWcqsbm73GR6vkort1uiSAkRBKqvOxsiJzRggVjtyHLBzZoTtUAPaYL1ng6dhydQCyuc3GqQ7Wei2+o6xxiugshiyrMzXhYBh/imRO6HalRWH7LNhw== X-Microsoft-Exchange-Diagnostics: 1; CY4PR02MB2855; 2:opuvNuhUxNafsOHH62bIBMC9FUL8hZgBp2BDgmYGW8ZVYnIAzft//OvZHXurmiWv3QUNr1Jzo0+xnpVnWNR9htN1sTQNilcwLVO5tBkR9QtokotuCz6Be2uj3Nj9UD8PjkW1Fy+485jaK/Ebzmu8WXdwbDnrKIzuQFh/60yn6VI=; 3:1vbt0boALInKrsnVx77rjUnBUxOLDjJbLPrJ4EQXYMBzu7k3ZOiGmxn6PRqtwqK5Piag3tDI7nl9eB1ZrW/5e3SNdW8tfPWMhlmAEkWqOBijYfGJ3LGzWyeSLpT2Bb5Rnp0K6maB9nE3RRto7r4yHcq3WohBx8FEoZIOlyZGEX3elUI2jsx2elWKO8vWsVMq7g7yeCC/bnMoYlwul0pZLBpGO7AOEFR7r1cybJXVZ0f8fj0+O6CL/7dl3Gc7IYkkXrEqQwH3CxfstvfGXgtuDULN03Jtvn62NdWu6xzQNsE= X-MS-Office365-Filtering-Correlation-Id: dcc077a6-23c6-44f5-c2ce-08d4123b33b3 X-Microsoft-Antispam: UriScan:; BCL:0; PCL:0; RULEID:(22001)(8251501002); SRVR:CY4PR02MB2855; X-Microsoft-Exchange-Diagnostics: 1; CY4PR02MB2855; 25:FgS0rOjieAG1QLZLBzEAphrmZaHrGX3kO8yUHs67rO7lKUHXUwJtKZTSMG4zKZlpajJmcDOc7w0xVrrvsR5iBIyxgjmA7kagF0QH/GiOoSszfBYAEipb2THmckqR5Pw5/TKvXu8mpA9quethLXJJtV7DxWblVg1UV7tHf4ANHAapoA5rB7TyXOIpFwiR8CVsq4Gm4A0mR0YA/oZSw5gT0vkOx9bbo9Nf1In+QdSc7nxm0BQAhyyCIgXDnmcld4fN2bssk8UII3BjSeHk2a+2xHgO116xDN4CRqawGe9ClyYLorNwyyBZjbpDDfLFLKEW1aIPweA9Y4mc1MkRME/gtKtuBIffZVtM+4pANxXk7kvxkIbpfrhZ3n262YtycoBraXVoTjQDIRMEy6awj0yHc5W/hH4xJoHiDInxVK3zwMoKoLVXZOC2ObBdlr01UJP2/99DI87M7xXpHvW6wHn+0Q==; 31:cOQhf7tGFxbNwH2jKtN8eujD3IlT7u586K8LZNYRn9NKtgNt+DBHthD0vYDEYdb/iedjXLpTn/Ozr1msGvrwmI+KaKxNFDEeCq+38d5DW7sL/icwSU+Ef7TGsXTL2Doxf7bkKsRxCSfsad81Q9GEwJA/sVLtWZi6GAoOJ5B4sgHV2n0Yz/AfqsR5w//yaX/V9aKOK6BDsSrUuTzK5XRwBs9kOphr8h+VUYhcxBR0Z/SE85HoTZTJudyYAyOd8XzAcvzARyD0jNBzB0mDWK61EM28OrjMlQGTiMw/e0TGbZI= X-Microsoft-Exchange-Diagnostics: 1; CY4PR02MB2855; 20:5E/5bVitHiP9MPebXbL3wyYz+BLe2OwYsFaA/rR2OnrYlVPKySmBpB9Ve1HPioqgAQLN0PpSiVTAZBxYtkP1PNWRgw0bme4PIIZW9ZSQVNpG2uvMmhj5CdhGWCas96psSDTpStnN204NBzTUytVLCqawalX7fODbFWEBD3gPY93qAZEj2tRQ3IMLsm1phNt+5h42arUHgco2CmF4qhRId2c4mRwSQOigL2IepDkkMthSzB2RK0wnJ8Qq7n+w0v+kx+o2FvwlPEBq2yspbcICy/s5p0QVH3Xby05JwJKVJDnUAtK0UZot+9qQ2lmN2NAoGya3awDDjkgwy+HJML13oltnJEnhxZdiOK8DdaM5q0i+Y7tyzFdU4adCEn0ZWYwga17Q+RNvK65ZvongkikYLLqPeLMTnV43s120f2gnJzGLznXIhsS1vo7AIKimdRAT6zkum4vlE9Jwz5ZsSr0W18TquIW2Qjy5vBHQsO63LlTDuX5lBcJvkXmFCX4BtRk6 X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-Test: UriScan:(20558992708506)(9452136761055)(131327999870524)(42932892334569)(228905959029699); X-Exchange-Antispam-Report-CFA-Test: BCL:0; PCL:0; RULEID:(6045199)(6040307)(6060326)(601004)(2401047)(13016025)(13018025)(5005006)(8121501046)(10201501046)(3002001)(6055026)(6041248)(6061324)(6072148)(6042181); SRVR:CY4PR02MB2855; BCL:0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E X-OriginatorOrg: sandisk.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 21 Nov 2016 18:21:23.4951 (UTC) X-MS-Exchange-CrossTenant-Id: fcd9ea9c-ae8c-460c-ab3c-3db42d7ac64d X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=fcd9ea9c-ae8c-460c-ab3c-3db42d7ac64d; Ip=[63.163.107.225]; Helo=[milsmgep14.sandisk.com] X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: CY4PR02MB2855 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 The array ib_mad_mgmt_class_table.method_table has MAX_MGMT_CLASS (80) elements. Hence compare the array index with that value instead of with IB_MGMT_MAX_METHODS (128). This patch avoids that Coverity reports the following: Overrunning array class->method_table of 80 8-byte elements at element index 127 (byte offset 1016) using index convert_mgmt_class(mad_hdr->mgmt_class) (which evaluates to 127). Fixes: commit b7ab0b19a85f ("IB/mad: Verify mgmt class in received MADs") Signed-off-by: Bart Van Assche Cc: Sean Hefty Cc: Reviewed-by: Hal Rosenstock --- drivers/infiniband/core/mad.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/infiniband/core/mad.c b/drivers/infiniband/core/mad.c index 40cbd6b..2395fe2 100644 --- a/drivers/infiniband/core/mad.c +++ b/drivers/infiniband/core/mad.c @@ -1746,7 +1746,7 @@ find_mad_agent(struct ib_mad_port_private *port_priv, if (!class) goto out; if (convert_mgmt_class(mad_hdr->mgmt_class) >= - IB_MGMT_MAX_METHODS) + ARRAY_SIZE(class->method_table)) goto out; method = class->method_table[convert_mgmt_class( mad_hdr->mgmt_class)];