Received: by 2002:a25:ad19:0:0:0:0:0 with SMTP id y25csp10478983ybi; Thu, 25 Jul 2019 00:01:51 -0700 (PDT) X-Google-Smtp-Source: APXvYqxXcJ4jsjO2hwbr19jhcqQYGY/uH8X8/EumGq1lfz6Drm64L2j7dzs4TwMEC4jqrbjgOpFk X-Received: by 2002:a17:902:7448:: with SMTP id e8mr89648910plt.85.1564038111863; Thu, 25 Jul 2019 00:01:51 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1564038111; cv=none; d=google.com; s=arc-20160816; b=bVnAIkFQphr90V/6Ztsj2+riYFsyI8yVeZ/Xk2zS4we2P/rtQdwCXOkKyw7fqET6Oc Vad7Ud/tKEWOv34X8uX+jqCHLro7yGP4AHJmvcehtB4QSwor3EzScOO95/y0T4INRW23 DpJQtPYrC9FgEstp1eMP+knxkzhAIc76bAhr4DqJaKAB/CT2P9178VH032jbs+Lnce39 zANybiOjPIMS9PNT/dShgV08Tk2pP/iCAteqoAITV3iBtacXHk1F9W5a+/yGxNTGJE+a 1YUJ6tnnCDdzS23WlB6THM1eG+0PCzv06fLZvmBPwalA9OlZANjUo/VR3syktfxPWg15 1hTQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=pSEfZT+GISW9WTtX94MYYnc4FUSVzDbsjiecbQynEj4=; b=U9ZAhDK7W6DjobgFlu9NnEOySH1QsxDE3CTs1LZZ929XJpTzvGt0AXS5EGOxSq1zBq nSteIeOfYPR74L0+OOk2yruqfV6+I/EKv5MOYAe7agdTyUu19OHw8/OK+EQgGFTkIDES clp1Mnn+cTYtnvnY4IrFB5LER7Ce5yYClwS8m/zbvsKcTs0eaAOTHHdvMa+laWwh3rwS /MRtoKvG7+ouBw2f7vnp5zak8pL82A6FbCGZMiCsx17NxWIuKU0P/IDlT2ckaqXhCSDS Tr4VmnCB6Dit/YooDs97u/2PRLj1zN0+dFOxNne3D5gjO0y1SVwaSkk83wOworv9mwit 1ioA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=sz7jyTkE; 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 cf16si14703627plb.346.2019.07.25.00.01.37; Thu, 25 Jul 2019 00:01:51 -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; dkim=pass header.i=@kernel.org header.s=default header.b=sz7jyTkE; 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 S2387672AbfGYHBF (ORCPT + 99 others); Thu, 25 Jul 2019 03:01:05 -0400 Received: from mail.kernel.org ([198.145.29.99]:34104 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725808AbfGYHBF (ORCPT ); Thu, 25 Jul 2019 03:01:05 -0400 Received: from localhost (83-86-89-107.cable.dynamic.v4.ziggo.nl [83.86.89.107]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 0371B2070B; Thu, 25 Jul 2019 07:01:03 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1564038064; bh=4CfUye+GgQ2gJMBez5GCw03r+W5Lg5lhKAG1QSnvLsg=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=sz7jyTkEKYHv9cAcxBMbDFFyk9Vg7lLKUrhtVicOoAyf4BGFbsS/HFB2Myr8wSoMF 5oqAHUWN2+iGkSUd5Lw79E78S5Ske2mbT72gE6QBSKdw0pR9diYO/7hsuH0cdYXarb RCpSgpzFhVg7o+BA2oee+4hDc8kzfv779bED68OA= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Kangjie Lu , "Lad, Prabhakar" , Mukesh Ojha , Mauro Carvalho Chehab , Sasha Levin Subject: [PATCH 5.2 024/413] media: vpss: fix a potential NULL pointer dereference Date: Wed, 24 Jul 2019 21:15:15 +0200 Message-Id: <20190724191737.185755747@linuxfoundation.org> X-Mailer: git-send-email 2.22.0 In-Reply-To: <20190724191735.096702571@linuxfoundation.org> References: <20190724191735.096702571@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org [ Upstream commit e08f0761234def47961d3252eac09ccedfe4c6a0 ] In case ioremap fails, the fix returns -ENOMEM to avoid NULL pointer dereference. Signed-off-by: Kangjie Lu Acked-by: Lad, Prabhakar Reviewed-by: Mukesh Ojha Signed-off-by: Mauro Carvalho Chehab Signed-off-by: Sasha Levin --- drivers/media/platform/davinci/vpss.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/drivers/media/platform/davinci/vpss.c b/drivers/media/platform/davinci/vpss.c index 3f079ac1b080..be91b0c7d20b 100644 --- a/drivers/media/platform/davinci/vpss.c +++ b/drivers/media/platform/davinci/vpss.c @@ -509,6 +509,11 @@ static int __init vpss_init(void) return -EBUSY; oper_cfg.vpss_regs_base2 = ioremap(VPSS_CLK_CTRL, 4); + if (unlikely(!oper_cfg.vpss_regs_base2)) { + release_mem_region(VPSS_CLK_CTRL, 4); + return -ENOMEM; + } + writel(VPSS_CLK_CTRL_VENCCLKEN | VPSS_CLK_CTRL_DACCLKEN, oper_cfg.vpss_regs_base2); -- 2.20.1