Received: by 2002:a25:ad19:0:0:0:0:0 with SMTP id y25csp1082711ybi; Fri, 2 Aug 2019 09:04:04 -0700 (PDT) X-Google-Smtp-Source: APXvYqwD/QxlQGzYRKjFnM4Ak0jHe6JQaZbSyGGjHDejY/aCi0rwZ0v8wuwtOaqCoNeCi+8j+dvn X-Received: by 2002:a17:90a:8a84:: with SMTP id x4mr4912363pjn.105.1564761844770; Fri, 02 Aug 2019 09:04:04 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1564761844; cv=none; d=google.com; s=arc-20160816; b=y7yYxPvqaiftmMhmU0WLzAEQqBDTPUiuWs4jq0jHinM1ct68Syo7yBKxhO3HZe6j9C XD43zMNj1lq5AtM6YOpvkWXFUvTVn+fnN3P0v2OISCvKTs62fyPyW8GCH1KYDRV5qi28 Q+bz+zpThNfb24umqkNpdNzncwo29vEedNWEK3iHxSiF8eNx3i9CKjj/nzchUqOWPd7M FCbsP4/TU1O2nMugSSyncR8Lu1LAwRYzhB9tYJlMMdf2KbzOCTleQ1Lf5g7QkPI68aIB HnRqSZBtixtuLQTK+5fzXYIUvo7s2IzSUFv+JbkdAZ3l1ln+mRvAnxjTybRfsv0FZtft plkg== 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=jB1qYAJm0fPTMqJdqMLlarctVtOJ6JCXyWSS+4igIRk=; b=rc92yN1rZZ3PlNNNyActH8AOb+2Z5q6qbsj5FI/Is8DHe9JSYDNJqHlbcJkUapuDyE beCrTkGA8YcCU6JVExo+gMF/wGaZC1zmutHnfNf3OPO6HVHVghiOe2ctBZpkkjCo2g72 fAf4VT1D1Xy3630i9Mfp2KJhUKCeiOIQvSx8mZiTblJ0O0Yv0umhIsJNzsSQQC0ygG4m nU3I+PFu7pFTKGOJKdgR5XuejvFr0FipdJdoY+n0nN/Ath7XJdaWN+aOyVxldJtrlhQ7 O8+SaulChVxKQAPttMgZlz9HGdyhrAYQBjWuVv9AlKIOXljQQzpxz1O/v93Q4j7Wn5XT JzRQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=RfKfTKXP; 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 e96si34675907plb.123.2019.08.02.09.03.49; Fri, 02 Aug 2019 09:04:04 -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=RfKfTKXP; 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 S2404871AbfHBJgs (ORCPT + 99 others); Fri, 2 Aug 2019 05:36:48 -0400 Received: from mail.kernel.org ([198.145.29.99]:37782 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1731185AbfHBJgq (ORCPT ); Fri, 2 Aug 2019 05:36:46 -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 0AC3E20679; Fri, 2 Aug 2019 09:36:45 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1564738606; bh=8IIMUHMrZoPzODrWWUAqnXm6e6fPk7EjY17juQs2q7w=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=RfKfTKXPkPXoJVHyUbnl4zGpuiRtVZUm229OgjMru21+gYCN5wjn0DjwhLnde0QIL +ADCSzmcV+oW5qaFPFfT/DcjYlgwB2km95OTyE5bXzML2bYGHGaPXL6eutQg6aGBRb 8l+x+gp9I/fyecdhbhEfi/B0BEYwhhW8y0eD3X9Y= 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.4 012/158] media: vpss: fix a potential NULL pointer dereference Date: Fri, 2 Aug 2019 11:27:13 +0200 Message-Id: <20190802092205.941621441@linuxfoundation.org> X-Mailer: git-send-email 2.22.0 In-Reply-To: <20190802092203.671944552@linuxfoundation.org> References: <20190802092203.671944552@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 fce86f17dffc..c2c68988e38a 100644 --- a/drivers/media/platform/davinci/vpss.c +++ b/drivers/media/platform/davinci/vpss.c @@ -523,6 +523,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