From patchwork Mon Jan 7 15:27:55 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Gal Pressman X-Patchwork-Id: 10750725 X-Patchwork-Delegate: jgg@ziepe.ca Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 23D77746 for ; Mon, 7 Jan 2019 15:28:08 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 1299E209CE for ; Mon, 7 Jan 2019 15:28:08 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 06D8628355; Mon, 7 Jan 2019 15:28:08 +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=-8.0 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,MAILING_LIST_MULTI,RCVD_IN_DNSWL_HI 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 8DDD7209CE for ; Mon, 7 Jan 2019 15:28:07 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729848AbfAGP2H (ORCPT ); Mon, 7 Jan 2019 10:28:07 -0500 Received: from smtp-fw-6002.amazon.com ([52.95.49.90]:32884 "EHLO smtp-fw-6002.amazon.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727418AbfAGP2H (ORCPT ); Mon, 7 Jan 2019 10:28:07 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=amazon.com; i=@amazon.com; q=dns/txt; s=amazon201209; t=1546874886; x=1578410886; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version; bh=KjXdMroZ/X5Kor1MmIhRtQrcE8/Ok2Qz18TGao+2kKU=; b=dxZSMyzNGcOlXmzcl7/fm/9noVgI4gXJ4D5bUXp0Ku8ubV+1I4Jj+v3j hmWRTIc2h5O+zyMq8Omwzth3tbrJxLEhqVWBswoNsq7GzJy13FG0ihT7/ 825slhX/B2fFqWmGhsdDQsBtapQG7GVtee7mxNDtclMa7X9xmX0/S7RiS c=; X-IronPort-AV: E=Sophos;i="5.56,253,1539648000"; d="scan'208";a="380573928" Received: from iad6-co-svc-p1-lb1-vlan3.amazon.com (HELO email-inbound-relay-2b-55156cd4.us-west-2.amazon.com) ([10.124.125.6]) by smtp-border-fw-out-6002.iad6.amazon.com with ESMTP/TLS/DHE-RSA-AES256-SHA; 07 Jan 2019 15:28:04 +0000 Received: from EX13MTAUEA001.ant.amazon.com (pdx1-ws-svc-p6-lb9-vlan3.pdx.amazon.com [10.236.137.198]) by email-inbound-relay-2b-55156cd4.us-west-2.amazon.com (8.14.7/8.14.7) with ESMTP id x07FS0wI086518 (version=TLSv1/SSLv3 cipher=AES256-SHA bits=256 verify=FAIL); Mon, 7 Jan 2019 15:28:03 GMT Received: from EX13D19EUB002.ant.amazon.com (10.43.166.78) by EX13MTAUEA001.ant.amazon.com (10.43.61.82) with Microsoft SMTP Server (TLS) id 15.0.1367.3; Mon, 7 Jan 2019 15:28:03 +0000 Received: from EX13MTAUEA001.ant.amazon.com (10.43.61.82) by EX13D19EUB002.ant.amazon.com (10.43.166.78) with Microsoft SMTP Server (TLS) id 15.0.1367.3; Mon, 7 Jan 2019 15:28:02 +0000 Received: from galpress-VirtualBox.hfa16.amazon.com (10.218.62.29) by mail-relay.amazon.com (10.43.61.243) with Microsoft SMTP Server id 15.0.1367.3 via Frontend Transport; Mon, 7 Jan 2019 15:28:00 +0000 From: Gal Pressman To: Doug Ledford , Jason Gunthorpe CC: , Gal Pressman , "Selvin Xavier" , Devesh Sharma Subject: [PATCH rdma-next 2/3] RDMA/ocrdma: Fix out of bounds index check in query pkey Date: Mon, 7 Jan 2019 17:27:55 +0200 Message-ID: <1546874876-24589-2-git-send-email-galpress@amazon.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1546874876-24589-1-git-send-email-galpress@amazon.com> References: <1546874876-24589-1-git-send-email-galpress@amazon.com> MIME-Version: 1.0 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 pkey table size is one element, index should be tested for > 0 instead of > 1. Fixes: fe2caefcdf58 ("RDMA/ocrdma: Add driver for Emulex OneConnect IBoE RDMA adapter") Cc: Selvin Xavier Cc: Devesh Sharma Signed-off-by: Gal Pressman --- drivers/infiniband/hw/ocrdma/ocrdma_verbs.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/infiniband/hw/ocrdma/ocrdma_verbs.c b/drivers/infiniband/hw/ocrdma/ocrdma_verbs.c index c46bed0c5513..6655366affab 100644 --- a/drivers/infiniband/hw/ocrdma/ocrdma_verbs.c +++ b/drivers/infiniband/hw/ocrdma/ocrdma_verbs.c @@ -55,7 +55,7 @@ int ocrdma_query_pkey(struct ib_device *ibdev, u8 port, u16 index, u16 *pkey) { - if (index > 1) + if (index > 0) return -EINVAL; *pkey = 0xffff;