From mboxrd@z Thu Jan 1 00:00:00 1970 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 183A5C33CB2 for ; Tue, 28 Jan 2020 14:08:54 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id DE4212468A for ; Tue, 28 Jan 2020 14:08:53 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1580220533; bh=NJ7xs43QwIvqL/GyfrBjI9MfIpNBCWxkCJxaSIUNzPo=; h=From:To:Cc:Subject:Date:In-Reply-To:References:List-ID:From; b=I59SNCowjY8QDkkK2QeLCF6gSHAK4M9GPj8XAeBpMSkCX3nW9vF76wNz6nW9O911Z QSo7qtTNP4FRaCUzD9nUeBfMU/Yo4SevhmYVJu/zw5xdHZD6MrdXkuc4NYozUzv4s9 sw1a9v+X2JNKg9e5GOGqoTiCxPIxgAI31EHFB+08= Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727581AbgA1OIw (ORCPT ); Tue, 28 Jan 2020 09:08:52 -0500 Received: from mail.kernel.org ([198.145.29.99]:56808 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728575AbgA1OIk (ORCPT ); Tue, 28 Jan 2020 09:08:40 -0500 Received: from localhost (83-86-89-107.cable.dynamic.v4.ziggo.nl [83.86.89.107]) (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 F2FF22468A; Tue, 28 Jan 2020 14:08:38 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1580220519; bh=NJ7xs43QwIvqL/GyfrBjI9MfIpNBCWxkCJxaSIUNzPo=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=rfQfE1affEl6EHAapUummPm8o9xaCA9a2jhLhILWnWon8AEuzbqbE2UBGmmq0d19Y NwXEUcFd7txJUoB5m/FeMllxMv+Z1C0GRyg2YhP4mQOQpUNFuHmQUltATfJDYi3dpB TNEbd4oc5xNWkWFyiD7DunBVM1iQd6vSupQ6jlA4= 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.4 032/183] IB/usnic: Fix out of bounds index check in query pkey Date: Tue, 28 Jan 2020 15:04:11 +0100 Message-Id: <20200128135833.219237145@linuxfoundation.org> X-Mailer: git-send-email 2.25.0 In-Reply-To: <20200128135829.486060649@linuxfoundation.org> References: <20200128135829.486060649@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@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 f8e3211689a34..8e18bfca55166 100644 --- a/drivers/infiniband/hw/usnic/usnic_ib_verbs.c +++ b/drivers/infiniband/hw/usnic/usnic_ib_verbs.c @@ -427,7 +427,7 @@ int usnic_ib_query_gid(struct ib_device *ibdev, u8 port, int index, 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; -- 2.20.1