Received: by 2002:ad5:474a:0:0:0:0:0 with SMTP id i10csp3306258imu; Sun, 11 Nov 2018 12:02:36 -0800 (PST) X-Google-Smtp-Source: AJdET5dGBZHKBpmp3vcnY/BStUFWMXquQTlUatMLnsiY7l7bSt2FNE9Alh3BUExCqnc4+m5CMJTu X-Received: by 2002:a17:902:b03:: with SMTP id 3-v6mr17469617plq.233.1541966555990; Sun, 11 Nov 2018 12:02:35 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1541966555; cv=none; d=google.com; s=arc-20160816; b=rbwu2jwDosJFAdz1AEBuJBSWDAbjrXJDUbz7Aaftam3NoflC7AeCWv2CanjUlBAWb3 UE2+bs7OuoBtQ6yIk7KKslH5JvwvER3FWoOyGqyMyAuBSQCLRx4xVzWXe8Y03SpQp5VV jagnx9wX7e5raAt4ZKb0aY//8F2kZz0n7nnKEvl5kja2Xx0wBhLtHX1kw1M//VVlXgR8 3yy5KVfCxalv6KMGSfo2AMoWwC/D+INpvCVTNqcBTXn4bNwJdjJPQdJoJ+4JzVCvAWmL 2G73uueE1W+/PWApbrqoRdmb6sf/EPa3sO76WQzTi3iDNzLW4wagIQIuO80HFg2o7zUO BZrg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:in-reply-to:subject:message-id:date:cc:to :from:mime-version:content-transfer-encoding:content-disposition; bh=q2br6WGvDROgax5B63p7Q3LoCWWIM0jd4xGWO1X1rns=; b=nduLrkCp8xxlA6uNZfR/uB8+Q6KEaevGqn+FaqGIpxD118qOT9n+xrXLoY5gUg6vJz jzsBH8L4cGXIcuB7aUuyhB1apCL+5ypwlt/AJm2B4UaexQesP4zrrOoMdJQyqCvLpQtK KQeFaKJ2lAvwwGv6h8xae34o7aoOSKlJ7qInz8R0ITFVhv1DXpzNphsra8BnDDRJckSx Gh/mkdwMMuxZAYYHTXO2aAVS+SuM4CTZknmLzO93oGNRxOm6FdInRTIQqnmfRwhEM/VO yDv+NK0hlt4gkQ2KsS0t5ZQbTK/V3Xq3lipBwUHcWFO1lt4H3z9uw7ZwhzZr9URngMwo qG/g== 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 l6si5797624pgg.592.2018.11.11.12.02.20; Sun, 11 Nov 2018 12:02:35 -0800 (PST) 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 S1730857AbeKLFsf (ORCPT + 99 others); Mon, 12 Nov 2018 00:48:35 -0500 Received: from shadbolt.e.decadent.org.uk ([88.96.1.126]:51006 "EHLO shadbolt.e.decadent.org.uk" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1730628AbeKLFs3 (ORCPT ); Mon, 12 Nov 2018 00:48:29 -0500 Received: from [192.168.4.242] (helo=deadeye) by shadbolt.decadent.org.uk with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.89) (envelope-from ) id 1gLvso-0000oJ-Jx; Sun, 11 Nov 2018 19:58:58 +0000 Received: from ben by deadeye with local (Exim 4.91) (envelope-from ) id 1gLvsX-0001lJ-O5; Sun, 11 Nov 2018 19:58:41 +0000 Content-Type: text/plain; charset="UTF-8" Content-Disposition: inline Content-Transfer-Encoding: 8bit MIME-Version: 1.0 From: Ben Hutchings To: linux-kernel@vger.kernel.org, stable@vger.kernel.org CC: akpm@linux-foundation.org, "Marc Kleine-Budde" , "Nicholas Mc Guire" Date: Sun, 11 Nov 2018 19:49:05 +0000 Message-ID: X-Mailer: LinuxStableQueue (scripts by bwh) Subject: [PATCH 3.16 279/366] can: mpc5xxx_can: check of_iomap return before use In-Reply-To: X-SA-Exim-Connect-IP: 192.168.4.242 X-SA-Exim-Mail-From: ben@decadent.org.uk X-SA-Exim-Scanned: No (on shadbolt.decadent.org.uk); SAEximRunCond expanded to false Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 3.16.61-rc1 review patch. If anyone has any objections, please let me know. ------------------ From: Nicholas Mc Guire commit b5c1a23b17e563b656cc9bb76ce5323b997d90e8 upstream. of_iomap() can return NULL so that return needs to be checked and NULL treated as failure. While at it also take care of the missing of_node_put() in the error path. Signed-off-by: Nicholas Mc Guire Fixes: commit afa17a500a36 ("net/can: add driver for mscan family & mpc52xx_mscan") Signed-off-by: Marc Kleine-Budde Signed-off-by: Ben Hutchings --- drivers/net/can/mscan/mpc5xxx_can.c | 5 +++++ 1 file changed, 5 insertions(+) --- a/drivers/net/can/mscan/mpc5xxx_can.c +++ b/drivers/net/can/mscan/mpc5xxx_can.c @@ -86,6 +86,11 @@ static u32 mpc52xx_can_get_clock(struct return 0; } cdm = of_iomap(np_cdm, 0); + if (!cdm) { + of_node_put(np_cdm); + dev_err(&ofdev->dev, "can't map clock node!\n"); + return 0; + } if (in_8(&cdm->ipb_clk_sel) & 0x1) freq *= 2;