Received: by 2002:a25:ad19:0:0:0:0:0 with SMTP id y25csp10480957ybi; Thu, 25 Jul 2019 00:03:46 -0700 (PDT) X-Google-Smtp-Source: APXvYqy48YExzGN/xv4WxDTMDkt7QnbiUOgter4R1fxVfKjQDRQ4Pk9qi6OjH4pZLpCQQO71KCI9 X-Received: by 2002:a17:902:4683:: with SMTP id p3mr82636818pld.31.1564038226775; Thu, 25 Jul 2019 00:03:46 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1564038226; cv=none; d=google.com; s=arc-20160816; b=EqvBXBk2GIaVqLdo2K4E7xA+Hwwt68SfLN13vAQT0Z5Gmto9uKBmWCVj6ttMdHFo1R v+tbEjFgoC78VBZ5rBgLvK5KW7OmbahOeSRQmV5F+gIFo58I75x/VoluJrO8Wr70uPz5 sbycDMKBnyzWMAEKUcarxe2C/H7X03ZYVsVjOYqfxC+sH0JvfHw6POi+jVEEoTXC7Q6T qXWw8g76Fl7VtXs5kfl0WpwuxwMCiqosqFzG+w0zEAB75ES8csMDvGLrpJAvWX7ck5+W meUM+R/Ghc8bZUHke5d4CFIVs3ygIb/C9qE2htTvsh71kv/FY1nJE0d19Xov1sjro6BR 9lsw== 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=N18UJlChMflcNOktIsXHfzPc0GJ+aIFALwEaEDc41G9ejavP7Upk38sLZK3fPebL84 tWx5v7IoC/l+IYBzc/2JvJnh69AgB6Uqw4ToJy6zAQPallB+pQljdncNOJAGR8matgOQ l+i5N6BGtcnZlv3Oc4b375RBD7PlPDHPzcs4CJiMj+N7qZsIjW9vOudiYuWBdgXJb8Tg JEQGjc/Qe76hHYCtYZMrJv9Mop9QQH81Tu5r960yFl/P6jQ+XYKczyClDZtw9lRxP/kY K2cim26PekGTlrqlDKF6p4sqIMGFdoYXg1q2PAvH2XvGlTqD7kn04oGRfTmdC1Z7b2af g2dg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=ABRVxiq9; 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 n17si13533588pgh.164.2019.07.25.00.03.32; Thu, 25 Jul 2019 00:03:46 -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=ABRVxiq9; 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 S2387629AbfGYHBu (ORCPT + 99 others); Thu, 25 Jul 2019 03:01:50 -0400 Received: from mail.kernel.org ([198.145.29.99]:34730 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728097AbfGYHBs (ORCPT ); Thu, 25 Jul 2019 03:01:48 -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 A26E022C7E; Thu, 25 Jul 2019 07:01:47 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1564038108; bh=fjKgVFMcK5w1eyT/mAWetn3wCytD8sHInZNTX6Y66tU=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=ABRVxiq9BKh9Xm1KLBDHBxCojHo2jjchPKt3CoaCi+buV4d4AlJtpNRsJC1+hfQ5c mlZAFk/XGk9+pchB6GPSf4gyJCRXPtDs/Zac2VBSGsXvnkELADo9Z1Q2MSdXI+uVzF by2/gs0uWvVFAwSL8zK5kvotfqpMhLr1aFGANsQ8= 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 4.19 020/271] media: vpss: fix a potential NULL pointer dereference Date: Wed, 24 Jul 2019 21:18:09 +0200 Message-Id: <20190724191656.970819710@linuxfoundation.org> X-Mailer: git-send-email 2.22.0 In-Reply-To: <20190724191655.268628197@linuxfoundation.org> References: <20190724191655.268628197@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