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=-2.9 required=3.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,SPF_PASS, URIBL_BLOCKED,USER_AGENT_GIT autolearn=ham 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 BAC67ECDFB3 for ; Tue, 17 Jul 2018 09:32:58 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 659AE20852 for ; Tue, 17 Jul 2018 09:32:58 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=synopsys.com header.i=@synopsys.com header.b="YT6mAULS" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 659AE20852 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=synopsys.com Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1731201AbeGQKEc (ORCPT ); Tue, 17 Jul 2018 06:04:32 -0400 Received: from smtprelay2.synopsys.com ([198.182.60.111]:39010 "EHLO smtprelay.synopsys.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1730281AbeGQKDS (ORCPT ); Tue, 17 Jul 2018 06:03:18 -0400 Received: from mailhost.synopsys.com (mailhost3.synopsys.com [10.12.238.238]) by smtprelay.synopsys.com (Postfix) with ESMTP id DF92710C178A; Tue, 17 Jul 2018 02:31:36 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=synopsys.com; s=mail; t=1531819896; bh=xJSdY6uhyjBuUskjVw0J29wx+bM9NbrOw6x6tTWCIoM=; h=From:To:Cc:Subject:Date:In-Reply-To:References:In-Reply-To: References:From; b=YT6mAULS8ts2lmMYuUCXH0N8xakwce3Eq6ywqbXR+I6MS/qnX8sI3j+UrLh8/D0CI mIy4jYvoNz81wmxi1/8S6EcB8496Ieng2+4bklmCl0ljonP5kIqsJ+oMRiNXAkfMBV xwxtSvJDgZuYBgrnP/uxs3nR42WgrgF5jk0MdD0MXMgTa1PLAXcTAHfBENX+QSFAxF ciGEaTlMNnkme7BIcPyyowi5NCWBUxgbNsj3kUVozjzmY/lKTvFZzKjcbD2vb/pAMO BqYoWPULlPR9O14SxB1UfaHoQQ6wNgyjI9v1BIUJW+/scaHyO2UdYDeZKUwXinsG14 FQiWxYiTnvtgA== Received: from de02.synopsys.com (de02.internal.synopsys.com [10.225.17.21]) by mailhost.synopsys.com (Postfix) with ESMTP id 8E2543FB5; Tue, 17 Jul 2018 02:31:36 -0700 (PDT) Received: from de02dwia024.internal.synopsys.com (de02dwia024.internal.synopsys.com [10.225.19.81]) by de02.synopsys.com (Postfix) with ESMTP id CADB13BC26; Tue, 17 Jul 2018 11:31:34 +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 v12 12/12] PCI: endpoint: Add MSI set maximum restriction Date: Tue, 17 Jul 2018 11:31:32 +0200 Message-Id: <7d5a9708368226edd1d461dec4b719ea5bffdf6c.1531818979.git.gustavo.pimentel@synopsys.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: References: In-Reply-To: References: Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@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. 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) -- 2.7.4