From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1756800AbcIFOuJ (ORCPT ); Tue, 6 Sep 2016 10:50:09 -0400 Received: from mout.kundenserver.de ([212.227.126.187]:51622 "EHLO mout.kundenserver.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1756780AbcIFOuI (ORCPT ); Tue, 6 Sep 2016 10:50:08 -0400 From: Arnd Bergmann To: linux-arm-kernel@lists.infradead.org Cc: Russell King - ARM Linux , linux-kernel@vger.kernel.org Subject: Re: [PATCH 2/4] ARM: common/locomo: remove NO_IRQ check Date: Tue, 06 Sep 2016 16:50:02 +0200 Message-ID: <4485846.n2NSoAbukL@wuerfel> User-Agent: KMail/5.1.3 (Linux/4.4.0-34-generic; KDE/5.18.0; x86_64; ; ) In-Reply-To: <20160906142144.GX1041@n2100.armlinux.org.uk> References: <20160906135637.2622666-1-arnd@arndb.de> <20160906135637.2622666-2-arnd@arndb.de> <20160906142144.GX1041@n2100.armlinux.org.uk> MIME-Version: 1.0 Content-Transfer-Encoding: 7Bit Content-Type: text/plain; charset="us-ascii" X-Provags-ID: V03:K0:Y8bX608Gp7WrfwR/V/AWXhENGN8ansojqt50LEqu2eV/gneAngT EgstcKQ1Ap/9uAjcQ7/cCXJDI97eaonrw+VzlOIuFpVPgFlsJMESfnEaKJT2tMqxVEAnoZU 0jNfLJoV5pbRyVRHeW0GzW3O6zVH1j2jw9xqF8nDPcCvqJuvU9pmC7y1/vdIryAcIBAfcoE K3qPf830eBtv91kv1Ehug== X-UI-Out-Filterresults: notjunk:1;V01:K0:ho+gW5YeuvY=:r+qW7/d6MBiG6DpdXZetRz iHY8kUM+eYAnIPGlhS6wEid6gA7rMAvvzgKe4pNocwJ7g8j/mLP4PrFOktMuSU7a9Xss9+G+t zChCXU/JICV75ESIk9nCKRHOtz1CKGlJP0yP5JlYHd5w/BTwfa2ToNYkzOpMEYffxiLhA6yVB nzNyVBlSVfcakarACWpWILNxhzcMBLgsK0uVFEA4RG6uXvhyfWob79CtnZoBiy9DVVWou1LB7 jJa6CSYA44Y+RcdUuKcWWcq+mYE4iDk/SvRgkRLmFiuglCVjlnCjgd1EKzV+PeQxETpuMmhVx yaN8aDyuErO4r+FV2lGwdVBSt/af8BYrBLF1vKCp2EoBLvGNUibqxQwyekzYUur9x9MvbFxEJ HF3p3FMYax5PYw/omqlznnQ7MnFiL8/yggLsmRgycnlbLhiNFGyc4VGt+Hlg40Ur0W9OQbsZj ghN91L7DnRV5ZZeDYD/xF5korpsUmzGq/CEihe0fgNWAEbvWxoC8yk0n3Kbr4Wz5p4L2CHYH8 3D1iU3ThiOQhlU6AQfmL2sRSw2v0vhmvc6RQ97DXvyT7HO6DOXSwIFT+HFJiHjI0RDw1YPIWF bhP7EcPy6hXSj9u8dMkLK04BaVBnQ/sZxYE8f0MiCRlntdLL2G/ins3w5vyTabQfHPhgFsPCR hMPcvQLU4eOrS0DuQbE1kgvJI616boBMkDKCk6oVLIlCMMqcWsM5P/AIZzA0niQNSd+j/20e1 nXYHgJHah8A/sUhU Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tuesday, September 6, 2016 3:21:44 PM CEST Russell King - ARM Linux wrote: > On Tue, Sep 06, 2016 at 03:53:28PM +0200, Arnd Bergmann wrote: > > Since commit 489447380a29 ("[PATCH] handle errors returned by > > platform_get_irq*()") ten years ago, the locomo driver refuses to > > work without an interrupt line passed in its resources, so the > > check for NO_IRQ is unnecessary. > > This description is inaccurate and misleading (it looks like it was > cut'n'pasted from patch 1.) > > platform_get_irq() has nothing to do with your change, as your change > is more about the irq_base value passed through platform data, and > not through IRQ resources. It was copied, but this part refers to this hunk irq = platform_get_irq(dev, 0); if (irq < 0) return -ENXIO; from locomo_probe that was changed in the same patch as the on in sa1111.c > > We still check the irq_base argument for NO_IRQ, but as both where the irq_base comes in. I'll try to reword this to make it clearer. > > @@ -387,7 +389,7 @@ __locomo_probe(struct device *me, struct resource *mem, int irq) > > > > lchip->phys = mem->start; > > lchip->irq = irq; > > - lchip->irq_base = (pdata) ? pdata->irq_base : NO_IRQ; > > + lchip->irq_base = pdata->irq_base; > > This removes a NULL pointer check. Before this change, a NULL pdata > would be accepted and would lead to the interrupts not being setup. > After this change, it results in a NULL pointer deference. > > Thankfully, both collie and poodle supply platform data, and are the > only providers of the locomo device. Right, that is what I tried to say above. With the check I've added in __locomo_probe, it would actually get the NULL pointer dereference earlier than this line. I'll add back that check earlier in the function and return an error in that case. Arnd From mboxrd@z Thu Jan 1 00:00:00 1970 From: arnd@arndb.de (Arnd Bergmann) Date: Tue, 06 Sep 2016 16:50:02 +0200 Subject: [PATCH 2/4] ARM: common/locomo: remove NO_IRQ check In-Reply-To: <20160906142144.GX1041@n2100.armlinux.org.uk> References: <20160906135637.2622666-1-arnd@arndb.de> <20160906135637.2622666-2-arnd@arndb.de> <20160906142144.GX1041@n2100.armlinux.org.uk> Message-ID: <4485846.n2NSoAbukL@wuerfel> To: linux-arm-kernel@lists.infradead.org List-Id: linux-arm-kernel.lists.infradead.org On Tuesday, September 6, 2016 3:21:44 PM CEST Russell King - ARM Linux wrote: > On Tue, Sep 06, 2016 at 03:53:28PM +0200, Arnd Bergmann wrote: > > Since commit 489447380a29 ("[PATCH] handle errors returned by > > platform_get_irq*()") ten years ago, the locomo driver refuses to > > work without an interrupt line passed in its resources, so the > > check for NO_IRQ is unnecessary. > > This description is inaccurate and misleading (it looks like it was > cut'n'pasted from patch 1.) > > platform_get_irq() has nothing to do with your change, as your change > is more about the irq_base value passed through platform data, and > not through IRQ resources. It was copied, but this part refers to this hunk irq = platform_get_irq(dev, 0); if (irq < 0) return -ENXIO; from locomo_probe that was changed in the same patch as the on in sa1111.c > > We still check the irq_base argument for NO_IRQ, but as both where the irq_base comes in. I'll try to reword this to make it clearer. > > @@ -387,7 +389,7 @@ __locomo_probe(struct device *me, struct resource *mem, int irq) > > > > lchip->phys = mem->start; > > lchip->irq = irq; > > - lchip->irq_base = (pdata) ? pdata->irq_base : NO_IRQ; > > + lchip->irq_base = pdata->irq_base; > > This removes a NULL pointer check. Before this change, a NULL pdata > would be accepted and would lead to the interrupts not being setup. > After this change, it results in a NULL pointer deference. > > Thankfully, both collie and poodle supply platform data, and are the > only providers of the locomo device. Right, that is what I tried to say above. With the check I've added in __locomo_probe, it would actually get the NULL pointer dereference earlier than this line. I'll add back that check earlier in the function and return an error in that case. Arnd