From patchwork Thu Jun 21 16:01:36 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Gustavo Pimentel X-Patchwork-Id: 932800 X-Patchwork-Delegate: lorenzo.pieralisi@arm.com Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=none (mailfrom) smtp.mailfrom=vger.kernel.org (client-ip=209.132.180.67; helo=vger.kernel.org; envelope-from=linux-pci-owner@vger.kernel.org; receiver=) Authentication-Results: ozlabs.org; dmarc=pass (p=none dis=none) header.from=synopsys.com Authentication-Results: ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=synopsys.com header.i=@synopsys.com header.b="Nl7uDc5S"; dkim-atps=neutral Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by ozlabs.org (Postfix) with ESMTP id 41BRMh22vQz9s3C for ; Fri, 22 Jun 2018 02:04:00 +1000 (AEST) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S933384AbeFUQDs (ORCPT ); Thu, 21 Jun 2018 12:03:48 -0400 Received: from smtprelay6.synopsys.com ([198.182.37.59]:57287 "EHLO smtprelay.synopsys.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S933169AbeFUQBt (ORCPT ); Thu, 21 Jun 2018 12:01:49 -0400 Received: from mailhost.synopsys.com (mailhost3.synopsys.com [10.12.238.238]) by smtprelay.synopsys.com (Postfix) with ESMTP id D6C691E1614; Thu, 21 Jun 2018 18:01:46 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=synopsys.com; s=mail; t=1529596907; bh=w1SFJn8eIzCg0mtUmxzE2PzOHIrAX/MxPVynWJUAh3c=; h=From:To:Cc:Subject:Date:In-Reply-To:References:In-Reply-To: References:From; b=Nl7uDc5SOlwQUOdeC3Nd22iuAAGyRdrteiy1yQA7jIyJJ16GnRv5CLhUbxBcV4nRc XCNW9a4KjJcrHAiENIkR+Zz3elLF6brHHuUjCrUzX1CF2gBwIQZg2eUAopNLA4xiS2 6jRIWApdzc4oUTYJWJgnYgBGyixv6AOEAMRIZ/v+hBYklCHv9xHOxKhWpzKClobzSP 3iTnAGE9GP9qP7zgwPLCDhD+OQb/IenFFJSO3wixLUU+wTFlLjnPXlZ20TSkH0OCZI Fz1g1TOUg/0Thj2B7YyOi6MXvv4gak08ZImvcjb4mP9NZk5YHU7cUSib3SmSKVDgqE 6gMeLpVE8LFHw== Received: from pt02.synopsys.com (pt02.synopsys.com [10.107.23.240]) by mailhost.synopsys.com (Postfix) with ESMTP id 113D339B1; Thu, 21 Jun 2018 09:01:46 -0700 (PDT) Received: from UbuntuMate-64Bits.internal.synopsys.com (gustavo-e7480.internal.synopsys.com [10.107.25.102]) by pt02.synopsys.com (Postfix) with ESMTP id 69A2B3D140; Thu, 21 Jun 2018 17:01:44 +0100 (WEST) From: Gustavo Pimentel To: bhelgaas@google.com, lorenzo.pieralisi@arm.com, Joao.Pinto@synopsys.com, jingoohan1@gmail.com, kishon@ti.com, adouglas@cadence.com, jesper.nilsson@axis.com, shawn.lin@rock-chips.com Cc: linux-pci@vger.kernel.org, linux-doc@vger.kernel.org, linux-kernel@vger.kernel.org, Gustavo Pimentel Subject: [PATCH v6 11/11] PCI: endpoint: Add MSI set maximum restriction. Date: Thu, 21 Jun 2018 17:01:36 +0100 Message-Id: <5bceea0ec98a7436ac5960635898ddfbec2cf6e1.1529595907.git.gustavo.pimentel@synopsys.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: References: In-Reply-To: References: Sender: linux-pci-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-pci@vger.kernel.org Add pci_epc_set_msi() maximum 32 interrupts validation. Signed-off-by: Gustavo Pimentel Acked-by: Kishon Vijay Abraham I --- Change v4->v5: - New patch file. Change v5->v6: - Nothing changed, just to follow the patch set version. drivers/pci/endpoint/pci-epc-core.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/drivers/pci/endpoint/pci-epc-core.c b/drivers/pci/endpoint/pci-epc-core.c index c72e656..094dcc3 100644 --- a/drivers/pci/endpoint/pci-epc-core.c +++ b/drivers/pci/endpoint/pci-epc-core.c @@ -201,7 +201,8 @@ int pci_epc_set_msi(struct pci_epc *epc, u8 func_no, u8 interrupts) u8 encode_int; unsigned long flags; - if (IS_ERR_OR_NULL(epc) || func_no >= epc->max_functions) + if (IS_ERR_OR_NULL(epc) || func_no >= epc->max_functions || + interrupts > 32) return -EINVAL; if (!epc->ops->set_msi)