From patchwork Fri Jan 24 09:27:55 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Greg KH X-Patchwork-Id: 233247 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-9.8 required=3.0 tests=DKIMWL_WL_HIGH, DKIM_SIGNED, DKIM_VALID, HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_PATCH, MAILING_LIST_MULTI, SIGNED_OFF_BY, SPF_HELO_NONE, SPF_PASS, USER_AGENT_GIT autolearn=unavailable autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id B97CEC2D0DB for ; Fri, 24 Jan 2020 09:47:09 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 848812087E for ; Fri, 24 Jan 2020 09:47:09 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1579859229; bh=a87u02FjVPD8LRMZR8CzuTxKerzE3qGn6YIz1X/zG8w=; h=From:To:Cc:Subject:Date:In-Reply-To:References:List-ID:From; b=hK9NLR6Frg8CxbufrKHcu3gswA7auh/VHB5/HEn63bh8R/Qxd7XsmPTn2whgNwihC MJfAUKaXpVGoOeq1jX/fuVQDBGlgveGXR8dPDeaF5fDo1eN7GW+wEDsHY1iedDM2po 1nFnDSlIOSLFwOLqjh2MJbpDON1LqLSXyOXithWk= Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1731104AbgAXJrF (ORCPT ); Fri, 24 Jan 2020 04:47:05 -0500 Received: from mail.kernel.org ([198.145.29.99]:46702 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1730667AbgAXJrE (ORCPT ); Fri, 24 Jan 2020 04:47:04 -0500 Received: from localhost (unknown [145.15.244.15]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id C6C3A206D5; Fri, 24 Jan 2020 09:47:02 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1579859223; bh=a87u02FjVPD8LRMZR8CzuTxKerzE3qGn6YIz1X/zG8w=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=YFl9xflIZsgm/eRTRSXKv+1jkaSqWKycnC3KB5isovwU5gCSX696sID7Kurc1AB9O TKFyYarIUPe9mcLzyUrcGcnUbTpp/sdiVE3SS8pSrMDCibmvmQxnia5/30LmvHlR+q 9bKP1CR44vu1yqotOYWK+Um+n8zcwZEcA7Uu7i+8= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Gal Pressman , Parvi Kaustubhi , Jason Gunthorpe , Sasha Levin Subject: [PATCH 4.14 057/343] IB/usnic: Fix out of bounds index check in query pkey Date: Fri, 24 Jan 2020 10:27:55 +0100 Message-Id: <20200124092927.361240046@linuxfoundation.org> X-Mailer: git-send-email 2.25.0 In-Reply-To: <20200124092919.490687572@linuxfoundation.org> References: <20200124092919.490687572@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Sender: stable-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: stable@vger.kernel.org From: Gal Pressman [ Upstream commit 4959d5da5737dd804255c75b8cea0a2929ce279a ] The pkey table size is one element, index should be tested for > 0 instead of > 1. Fixes: e3cf00d0a87f ("IB/usnic: Add Cisco VIC low-level hardware driver") Signed-off-by: Gal Pressman Acked-by: Parvi Kaustubhi Signed-off-by: Jason Gunthorpe Signed-off-by: Sasha Levin --- drivers/infiniband/hw/usnic/usnic_ib_verbs.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/infiniband/hw/usnic/usnic_ib_verbs.c b/drivers/infiniband/hw/usnic/usnic_ib_verbs.c index fdfa25059723d..2602c7375d585 100644 --- a/drivers/infiniband/hw/usnic/usnic_ib_verbs.c +++ b/drivers/infiniband/hw/usnic/usnic_ib_verbs.c @@ -423,7 +423,7 @@ struct net_device *usnic_get_netdev(struct ib_device *device, u8 port_num) int usnic_ib_query_pkey(struct ib_device *ibdev, u8 port, u16 index, u16 *pkey) { - if (index > 1) + if (index > 0) return -EINVAL; *pkey = 0xffff;