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=-4.0 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS, URIBL_BLOCKED autolearn=no 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 C0ED3C433E1 for ; Wed, 19 Aug 2020 13:44:15 +0000 (UTC) Received: from merlin.infradead.org (merlin.infradead.org [205.233.59.134]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 8C75D204FD for ; Wed, 19 Aug 2020 13:44:15 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="HEecJBQm"; dkim=fail reason="signature verification failed" (1024-bit key) header.d=kernel.org header.i=@kernel.org header.b="X2p4tG/l" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 8C75D204FD Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=kernel.org Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=merlin.20170209; h=Sender:Content-Type: Content-Transfer-Encoding:Cc:List-Subscribe:List-Help:List-Post:List-Archive: List-Unsubscribe:List-Id:Message-ID:References:In-Reply-To:Subject:To:From: Date:MIME-Version:Reply-To:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=Wx+giEZXbJl1xvZoYmzThZQZMAnB9lQQsX9q/g7yYqo=; b=HEecJBQmKMGpyX+aM2AowXFsX yk81kwb9REf9Z6qvo8Iw7mRYNqHo0noR+kMviMxPDKXrg7d4IKPDpWghqGaHlQrXizhMhdOF2sSEL kWDNPfM4XtQ+TpD168lCn9/Y2KDG6O1E9Ubq99lnqyqnTI4/AfO049HWeMLoGb17i8tZy2pv1B9CK 66VFYUfZyiDtqZK8JZTcFirB21fD6v202VC43+XYwbkVaDx5svTGlCvIkuyPJvqQeUh1HTL5veAfV HwMWNj0xskT5w67Y4F+tkDJP7d3IujKHb1CbztVbCjQw3NAyaCIvlc1lfVzrJPeroujwkDRv4L7Dx YRnZvaJuQ==; Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1k8OMf-0004NW-OQ; Wed, 19 Aug 2020 13:42:53 +0000 Received: from mail.kernel.org ([198.145.29.99]) by merlin.infradead.org with esmtps (Exim 4.92.3 #3 (Red Hat Linux)) id 1k8OMc-0004MX-L4; Wed, 19 Aug 2020 13:42:51 +0000 Received: from disco-boy.misterjones.org (disco-boy.misterjones.org [51.254.78.96]) (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 B3F5E204FD; Wed, 19 Aug 2020 13:42:49 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1597844569; bh=nRHlZ1MnhuRCWEVlVgqtKUWgqsrlzs+w4Nj+dZAbawc=; h=Date:From:To:Cc:Subject:In-Reply-To:References:From; b=X2p4tG/lI4UDoGQ0sW7iBjo5mfR7OsNSzk2uNq3Xhim97qLQo2BUAax5CH6LxWxQ3 SyLd/JY3Anlf1Vkm7UkfpDCr9hyV2G5dviys/6P/0z35NeRRb/G3vtxR+wiuYLfK9Q CM9M4FOLugd4F74QfZ7XQFOx/6L3XtyEgHhh141s= Received: from disco-boy.misterjones.org ([51.254.78.96] helo=www.loen.fr) by disco-boy.misterjones.org with esmtpsa (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.92) (envelope-from ) id 1k8OMa-004DzN-87; Wed, 19 Aug 2020 14:42:48 +0100 MIME-Version: 1.0 Date: Wed, 19 Aug 2020 14:42:48 +0100 From: Marc Zyngier To: Mark-PK Tsai Subject: Re: [PATCH 1/2] irqchip: irq-mst: Add MStar interrupt controller support In-Reply-To: (raw) References: (raw) User-Agent: Roundcube Webmail/1.4.7 Message-ID: X-Sender: maz@kernel.org X-SA-Exim-Connect-IP: 51.254.78.96 X-SA-Exim-Rcpt-To: mark-pk.tsai@mediatek.com, alix.wu@mediatek.com, daniel@0x0f.com, devicetree@vger.kernel.org, jason@lakedaemon.net, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, linux-mediatek@lists.infradead.org, matthias.bgg@gmail.com, robh+dt@kernel.org, tglx@linutronix.de, yj.chiang@mediatek.com X-SA-Exim-Mail-From: maz@kernel.org X-SA-Exim-Scanned: No (on disco-boy.misterjones.org); SAEximRunCond expanded to false X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20200819_094250_794137_092A8589 X-CRM114-Status: GOOD ( 19.15 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: devicetree@vger.kernel.org, alix.wu@mediatek.com, jason@lakedaemon.net, yj.chiang@mediatek.com, daniel@0x0f.com, linux-kernel@vger.kernel.org, robh+dt@kernel.org, linux-mediatek@lists.infradead.org, matthias.bgg@gmail.com, tglx@linutronix.de, linux-arm-kernel@lists.infradead.org Content-Transfer-Encoding: 7bit Content-Type: text/plain; charset="us-ascii"; Format="flowed" Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org On 2020-08-19 14:31, Mark-PK Tsai wrote: > From: Marc Zyngier > >> > + >> > +static int mst_intc_domain_alloc(struct irq_domain *domain, unsigned >> > int virq, >> > + unsigned int nr_irqs, void *data) >> > +{ >> > + int i; >> > + irq_hw_number_t hwirq; >> > + struct irq_fwspec parent_fwspec, *fwspec = data; >> > + struct mst_intc_chip_data *cd = (struct mst_intc_chip_data >> > *)domain->host_data; >> >> No cast necessary here. >> >> > + >> > + /* Not GIC compliant */ >> > + if (fwspec->param_count != 3) >> > + return -EINVAL; >> > + >> > + /* No PPI should point to this domain */ >> > + if (fwspec->param[0]) >> > + return -EINVAL; >> > + >> > + if (fwspec->param[1] >= cd->nr_irqs) >> >> This condition is bogus, as it doesn't take into account the nr_irqs >> parameter. >> > > > The hwirq number need to be in the irq map range. (property: > mstar,irqs-map-range) > If it's not, it must be incorrect configuration. I agree. And since you are checking whether the configuration is correct, it'd better be completely correct. > So how about use the condition as following? > > if (hwirq >= cd->nr_irqs) > return -EINVAL; Again, this says nothing of the validity of (hwirq + nr_irqs - 1)... > >> > + return -EINVAL; >> > + >> > + hwirq = fwspec->param[1]; >> > + for (i = 0; i < nr_irqs; i++) >> > + irq_domain_set_hwirq_and_chip(domain, virq + i, hwirq + i, >> > + &mst_intc_chip, >> > + domain->host_data); ... which you are using here. M. -- Jazz is not dead. It just smells funny... _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel