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=-9.0 required=3.0 tests=HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_PATCH,MAILING_LIST_MULTI,SIGNED_OFF_BY,SPF_PASS,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 AEF28C10F14 for ; Sat, 13 Apr 2019 07:21:52 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 88B0820869 for ; Sat, 13 Apr 2019 07:21:52 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727427AbfDMHVv (ORCPT ); Sat, 13 Apr 2019 03:21:51 -0400 Received: from www.osadl.org ([62.245.132.105]:36458 "EHLO www.osadl.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727372AbfDMHVs (ORCPT ); Sat, 13 Apr 2019 03:21:48 -0400 Received: from debian01.hofrr.at (178.115.242.59.static.drei.at [178.115.242.59]) by www.osadl.org (8.13.8/8.13.8/OSADL-2007092901) with ESMTP id x3D7JfAU003435; Sat, 13 Apr 2019 09:20:14 +0200 From: Nicholas Mc Guire To: Russell King Cc: Shawn Guo , Sascha Hauer , Pengutronix Kernel Team , Fabio Estevam , NXP Linux Team , Mark Brown , Linus Walleij , Tony Lindgren , Mike Rapoport , Janusz Krzysztofik , linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, Nicholas Mc Guire Subject: [PATCH] ARM: STi: at least warn if of_iomap fails Date: Sat, 13 Apr 2019 09:14:18 +0200 Message-Id: <1555139666-948-7-git-send-email-hofrat@osadl.org> X-Mailer: git-send-email 2.1.4 In-Reply-To: <1555139666-948-1-git-send-email-hofrat@osadl.org> References: <1555139666-948-1-git-send-email-hofrat@osadl.org> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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); } -- 2.1.4