Received: by 2002:a25:ad19:0:0:0:0:0 with SMTP id y25csp11019909ybi; Thu, 25 Jul 2019 08:37:19 -0700 (PDT) X-Google-Smtp-Source: APXvYqy3f5hdtk0q44D9jCvR6hJZFB/WPle8n0z9/dAGuEb9OiGHWz3W57IRyNIMbTJZAG4NgOLI X-Received: by 2002:aa7:93a8:: with SMTP id x8mr17837182pff.49.1564069038965; Thu, 25 Jul 2019 08:37:18 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1564069038; cv=none; d=google.com; s=arc-20160816; b=RYtf9rJkQEw4LmuaDCO+NSvb1cqjdHXTiTzoz2Sbeg/hf2sIbwbCfemcqLotjBcY2a upxyO9tksHn+p0d5Xl2+HuVKYh6dbzRg2euDnDL1g5sa18/Sfc5OKVBKo5wmguH/bxTJ I4tZDrmktPVZmGkozog3gKkDBEAIHkZzDtnukmG+4LFCTh1Ee/czckvEEQ4XYY2ceTTR 9d5GqtvVRAh4pe1nlcniYKnTMO9/UKJWz398fL+UckVLUFJ2s8kAzNXoQReN50TOznCX 6jx0klv7p4vninerldtDlPU7QNAXd/M5Mx3/+QGdqiU1Kk8DPGWOMObUL3YRPcdsqba0 taCQ== 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=/NvSf3OUy3erObIfAy5AkMOA13ca/yJOC1fAE3+lKn0=; b=nkyUyBHfN4L2896vQdH39Xqx99RxJK/gMuU4ek9pnfTUCUxdIBob8CZ5E5dBYWWk+x omtvdfmdf+INigo6UZvNzwNplkXxqIK1saffiv0HiUBa0kInkDXiqMEXOLcoaseGlj7s syXO2DLkYyHeXMpIbwsmX3VXS5QGnHRlqOsVrbdLgvpiYLosMCvQCM5cbWDFJyQ5YRL3 RiPCHj25t64gVvBTzaY3HpBgFGHCI2dGf9KK2UDeJ9ClNkD6ZydHOwZtvB8lIBcFAcMi UWwxwuHn8YpYaONSyEC3624jo8vYfE4h5EftQvibxnNM/Te7KdC1aEvjz626SiENp4ZA gCqg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=OEVoZJpT; 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 d37si15280335pla.288.2019.07.25.08.37.04; Thu, 25 Jul 2019 08:37:18 -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=OEVoZJpT; 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 S2387703AbfGYHBP (ORCPT + 99 others); Thu, 25 Jul 2019 03:01:15 -0400 Received: from mail.kernel.org ([198.145.29.99]:34280 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725808AbfGYHBN (ORCPT ); Thu, 25 Jul 2019 03:01:13 -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 D3E5C22ADA; Thu, 25 Jul 2019 07:01:12 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1564038073; bh=fjKgVFMcK5w1eyT/mAWetn3wCytD8sHInZNTX6Y66tU=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=OEVoZJpTByFDU9meO4RD4IOdTvUBonk0eWQ3zOPmsihwRmRTGLWb1teptSfi+lvOO G8XTB8W3CSVae2/kzKHn5ShapvA2uuB6tLmK8zuqjqynmdPw0f6BrGZTgXIZX6ZPl+ 2ZDD3XMOVT0JU2ys8frKCydWLgNvtaivwK0dV2Dg= 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.1 028/371] media: vpss: fix a potential NULL pointer dereference Date: Wed, 24 Jul 2019 21:16:20 +0200 Message-Id: <20190724191726.605678666@linuxfoundation.org> X-Mailer: git-send-email 2.22.0 In-Reply-To: <20190724191724.382593077@linuxfoundation.org> References: <20190724191724.382593077@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 19cf6853411e..89a86c19579b 100644 --- a/drivers/media/platform/davinci/vpss.c +++ b/drivers/media/platform/davinci/vpss.c @@ -518,6 +518,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