Received: by 2002:a25:ad19:0:0:0:0:0 with SMTP id y25csp4339008ybi; Tue, 30 Jul 2019 00:13:19 -0700 (PDT) X-Google-Smtp-Source: APXvYqy5z4dU+KOo60kHiXlpGfQH7GzBdVw5lh9H+hDEp9RF6FXZA/xtU+p6R4sHhP+IUDBLbNsw X-Received: by 2002:a17:90a:ad86:: with SMTP id s6mr116481596pjq.42.1564470799290; Tue, 30 Jul 2019 00:13:19 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1564470799; cv=none; d=google.com; s=arc-20160816; b=tIBYBghSfbmoPFeew3rF+wEIs9gDe4UAhf1/f7VZI4Qg8M//gH+s5bKAkUQadIErMp 4rE3oDs3wS5/kv0gwRlWsLhfiQzw4bePBqToYAcbX+C2EElxT+r5ldVcj8KfR2fqcDri KzEnZnVSjHXgNhSSjsdDqSYm7h+h7ODX7xZwcybjgo60ukK5jdGV0n/Kagx8C4kWbPQw Mk4sK+iaZuKy+H6G7X3aS2xM5ip6CwCOeMx/g/1tBHLQqqdYDpEyK98ehgzPGXTt7v0A 9PBFayss+BUMusGcO0BGAXCLDnkd+eSeOVAwo5uWbd3qjTYYUkNsjvdV9ylgMh8VXbHy 5/wQ== 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=4owHpd9My7p50TNQprCVr6WtI9WXSl7jCsR7doXfk5s=; b=ZDkwVZB+b7e6Ln448W/95O9xHloJKypCeWVgYU5TDvuQopShGvNDdEPkPPVXhOKq82 QH7Z5DJSWNcki3RzP52/bRK07IcJ8xfklH9g+myOyjMpbzXGU0PGFWkDx5WnrKMeisFB +azjaynb87VWDxvQFV2vXnsGXLELqThCrCLKMmhGSC4mNjMFyTg0RoFx71XKqfplEPVq 1ITGQMafz1pv/+N/idHJ526Asht1/yeWdoR3d3B3P9aFHjhIU0dpXwqVTzldyEyHYXwQ v0PjOcq3ilLrw7pMkLdS218VNmR+QrPpvJ131hLgDFWvb4Lc4/9Dv4T14oV1Gj5U3yUT IxGQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=YRmq1TF3; 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 j25si27626108pfr.11.2019.07.30.00.13.04; Tue, 30 Jul 2019 00:13:19 -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=YRmq1TF3; 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 S2391109AbfG2T6F (ORCPT + 99 others); Mon, 29 Jul 2019 15:58:05 -0400 Received: from mail.kernel.org ([198.145.29.99]:50440 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2403935AbfG2T6E (ORCPT ); Mon, 29 Jul 2019 15:58:04 -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 2C3062054F; Mon, 29 Jul 2019 19:58:02 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1564430283; bh=wjda5QJsyKPRuwfdHw8PBFYDu6Y7z8KRQaNDPrG6g20=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=YRmq1TF3qRi/SW2TYpVUyWhYt0SY+NqPtuxyc4wy5bEeEkUH/cuJeAhiF29pGwb3d 6+1nls2yBAvC1tK7giQWyH5NGlwo0DDh40KGIc6oVtYHvcS75YonBBNGVetGz5JdnR YLIPbd7coSFaKXJiVdLG9FqsN6sGnqhtrKfd2m2Q= 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.14 016/293] media: vpss: fix a potential NULL pointer dereference Date: Mon, 29 Jul 2019 21:18:27 +0200 Message-Id: <20190729190821.735961797@linuxfoundation.org> X-Mailer: git-send-email 2.22.0 In-Reply-To: <20190729190820.321094988@linuxfoundation.org> References: <20190729190820.321094988@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 f2d27b932999..2ee4cd9e6d80 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