From patchwork Thu Jul 19 08:32:22 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Gustavo Pimentel X-Patchwork-Id: 946109 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="dZS4SkS8"; dkim-atps=neutral Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by ozlabs.org (Postfix) with ESMTP id 41WS2x1FMvz9s55 for ; Thu, 19 Jul 2018 18:33:29 +1000 (AEST) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1730663AbeGSJPR (ORCPT ); Thu, 19 Jul 2018 05:15:17 -0400 Received: from smtprelay2.synopsys.com ([198.182.60.111]:54806 "EHLO smtprelay.synopsys.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1731086AbeGSJO2 (ORCPT ); Thu, 19 Jul 2018 05:14:28 -0400 Received: from mailhost.synopsys.com (mailhost1.synopsys.com [10.12.238.239]) by smtprelay.synopsys.com (Postfix) with ESMTP id 9BBEE10C0C0E; Thu, 19 Jul 2018 01:32:26 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=synopsys.com; s=mail; t=1531989146; bh=Mg1dhiTWJk8N00+YStOFHzu100RCbxS+nmLUfAvP3zo=; h=From:To:Cc:Subject:Date:In-Reply-To:References:In-Reply-To: References:From; b=dZS4SkS8GUvjRjx1wvvkR3qXpfUKLGIOd5naoEJLxlhu/fRHizm6/t5ZHQZCRWSe2 zSE22WhfxmHyTo7ghnRvKFfuIDdF59gbLkNLyZ4PB4lxPcvBXS/1As02p6fDx8Hvt/ LdOLXovy5qHscZOOJXL5275HZ0vOo+HlJM2sKfwwqzRJ28x7TaPWHe/I/E+YPJw6Ui BJbmjJ/tp5QVxO/8Al8maB4aJnGbWKRcq17pwYd6VTh42MW2atcu7lg4uUKLX8MOby 9dJgWXRny63PvFmHYKQpO717yY4oIIKzD/h5B55stwpiwhYyhrhi6QBMaMO7lDVNUn yEMFu3gf+IfcA== Received: from de02.synopsys.com (germany.internal.synopsys.com [10.225.17.21]) by mailhost.synopsys.com (Postfix) with ESMTP id 5469351C6; Thu, 19 Jul 2018 01:32:26 -0700 (PDT) Received: from de02dwia024.internal.synopsys.com (de02dwia024.internal.synopsys.com [10.225.19.81]) by de02.synopsys.com (Postfix) with ESMTP id 043817BDF; Thu, 19 Jul 2018 10:32:25 +0200 (CEST) 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 v14 12/12] PCI: endpoint: Add MSI set maximum restriction Date: Thu, 19 Jul 2018 10:32:22 +0200 Message-Id: <155e3f071ed30b3b630207f0a32ff68f1ac13cc6.1531922095.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. Change v6->v7: - Nothing changed, just to follow the patch set version. Change v7->v8: - Re-sending the patch series. Change v8->v9: - Nothing changed, just to follow the patch set version. Change v9->v10: - Nothing changed, just to follow the patch set version. Change v10->v11: - Nothing changed, just to follow the patch set version. Change v11->v12: - Nothing changed, just to follow the patch set version. Change v12->v13: - Re-sending the patch series. Change v13->v14: - 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)