From patchwork Thu Jul 12 15:48:50 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Nicholas Mc Guire X-Patchwork-Id: 10521871 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id C2442602C8 for ; Thu, 12 Jul 2018 15:53:04 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id AE16D29370 for ; Thu, 12 Jul 2018 15:53:04 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id A233D29448; Thu, 12 Jul 2018 15:53:04 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-2.9 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,MAILING_LIST_MULTI autolearn=ham version=3.3.1 Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 5D2B829AAF for ; Thu, 12 Jul 2018 15:53:04 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20170209; h=Sender: Content-Transfer-Encoding:Content-Type:MIME-Version:Cc:List-Subscribe: List-Help:List-Post:List-Archive:List-Unsubscribe:List-Id:Message-Id:Date: Subject:To:From:Reply-To:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:In-Reply-To: References:List-Owner; bh=MN+Hfn0yrsAJutY7yD2iFYmTifsoUt/HeDLqLOGu3sI=; b=uDQ +FE02GPmKAOJ2glToqjyq9IxipZKTlNcfWmV6xG7w9+yp2DEIyDfMh4Hjall6LLpVKOknzdNsmXBc tWC5ViMb6LOAaE3DBUhcJTF29kXaS2Bb9OGwA9TJIq5zv0NU1r1O0sOZmvHQZeUx4Mtdot+Z8lZr5 hespoUwJgn0WDsFBR3Sj8LLb8OYTYEBGZYAsAfFr2KROpm88k2xM2bTvjCYjvweR5YRPJbbV1uBE/ hyJPR0dJRBZ4m3OCF73joi+lVBX8ilbhn8Q2iPJGXOsPSVCGr2DGvsHkWz/ZCLYwszEmOs6ddG7NQ rO1nyG2WKHU9bZuEPZqZr3ZhUJ4QS5Q==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.90_1 #2 (Red Hat Linux)) id 1fddts-0003UR-G6; Thu, 12 Jul 2018 15:53:00 +0000 Received: from www.osadl.org ([62.245.132.105]) by bombadil.infradead.org with esmtps (Exim 4.90_1 #2 (Red Hat Linux)) id 1fddto-0003SU-Go for linux-arm-kernel@lists.infradead.org; Thu, 12 Jul 2018 15:52:58 +0000 Received: from debian01.hofrr.at (178.115.242.59.static.drei.at [178.115.242.59] (may be forged)) by www.osadl.org (8.13.8/8.13.8/OSADL-2007092901) with ESMTP id w6CFnXJ8002391; Thu, 12 Jul 2018 17:49:33 +0200 From: Nicholas Mc Guire To: Srinivas Kandagatla Subject: [PATCH] ARM: STi: at least warn if of_iomap fails Date: Thu, 12 Jul 2018 17:48:50 +0200 Message-Id: <1531410530-24163-1-git-send-email-hofrat@osadl.org> X-Mailer: git-send-email 2.1.4 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20180712_085256_863743_B29988C6 X-CRM114-Status: GOOD ( 10.65 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: linux-kernel@vger.kernel.org, Nicholas Mc Guire , Patrice Chotard , linux-arm-kernel@lists.infradead.org, Russell King MIME-Version: 1.0 Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org X-Virus-Scanned: ClamAV using ClamSMTP The call to of_iomap() is unchecked but scu_enable(), which the returned address is passed on to, assumes a valid mapping. If the mapping is invalid this could probably lead to undefined system state so at least a warning should be issued. Signed-off-by: Nicholas Mc Guire Fixes: commit 65ebcc115889 ("ARM: sti: Add STiH415 SOC support") --- Problem was found by an experimental coccinelle script Patch was compile tested with: multi_v7_defconfig (implies CONFIG_ARCH_STI=y, CONFIG_SMP=y) Patch is against 4.18-rc3 (localversion-next is next-20180712) arch/arm/mach-sti/platsmp.c | 1 + 1 file changed, 1 insertion(+) diff --git a/arch/arm/mach-sti/platsmp.c b/arch/arm/mach-sti/platsmp.c index 231f19e..89ae76f 100644 --- a/arch/arm/mach-sti/platsmp.c +++ b/arch/arm/mach-sti/platsmp.c @@ -109,6 +109,7 @@ static void __init sti_smp_prepare_cpus(unsigned int max_cpus) if (np) { scu_base = of_iomap(np, 0); + WARN_ON(!scu_base); scu_enable(scu_base); of_node_put(np); }