Received: by 2002:a25:4158:0:0:0:0:0 with SMTP id o85csp279584yba; Sat, 13 Apr 2019 00:23:06 -0700 (PDT) X-Google-Smtp-Source: APXvYqynCeiGM4JF4iWtV21E4qOpXQFfWd1nn/Og+Be0uM3usvg20Dgzhrhpd5lpYqrnKyqpZAFY X-Received: by 2002:a17:902:2865:: with SMTP id e92mr40672595plb.269.1555140186450; Sat, 13 Apr 2019 00:23:06 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1555140186; cv=none; d=google.com; s=arc-20160816; b=0semAo7XNMhF+85yJAZWyyS9qJeKxpSCmlk/CL8xkk5JXWVKVh163bGs7dPznOhbzG SqTE7tK45XC4egQFhR323WAtmxXe2jCIBwe5yJini3YCVXeNYgotCWVA7ImDo2m6z+gm LisqPYsloyDxAvjz8ce0LWMI0KtHSVN8UqdpHX4pIkybxMqbfY3xq47SoOwUbkqX6U6X 3Vws5gQX2zoVSWHz+aDfCqdippZZKK7Z4EcMVrW6SjptqUYK+G5EMgDh1XzyI+tDexa/ f6v/BOsyz0G33Pb4P/AMe/PdfJeAxrbpBMCRtrB715F4juqDgWyOcJAP5YNWqeM3anQZ LUJQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:in-reply-to:message-id:date :subject:cc:to:from; bh=91bydEqpm/6EkBf9Ohdn5poUkIPWw+AkyDzrUh1wLKg=; b=lMSjmaxndc0HXlN2U0TnxcsUAcaUvucfR4T51E7LSPwW+Z2eWGIQoMelqTBaZBOtC8 wbES2BEd8zAHMnS/r0XXj47Tj02DhSHYi9k8iPzfSWm+egOv8tPqAC6Rg6KHSWw08VNC x5k9XDeN/oxjlW5pTVeyTAZZ3QmYyTGtjy2bFuOdH6qECIBIa9OIm/+FYWC8EJrm0yoc CDm1tEH0HtHd/RXY8CCyUoIVSoHV3VVCxVgq28Ishh+7K7qBbzYTFQAtP3lT4dDiel8y 3zU4fhNh8QphG2IZsv9WsO9gq1rSyttbSS+8l8t73wIuUgwmRsm6PLcMsjWO8mJdpseg MCaA== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id k9si39257242pga.575.2019.04.13.00.22.50; Sat, 13 Apr 2019 00:23:06 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727412AbfDMHVu (ORCPT + 99 others); Sat, 13 Apr 2019 03:21:50 -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> X-Spam-Status: No, score=-1.9 required=6.0 tests=BAYES_00,DATE_IN_FUTURE_96_Q, RCVD_IN_DNSWL_MED autolearn=ham version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on www.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