Received: by 2002:a05:6a10:5bc5:0:0:0:0 with SMTP id os5csp3015835pxb; Mon, 18 Oct 2021 06:39:31 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzLFXgQ7jyRwVTnu+w0UiZKQ2he3g37Th3YQvS5dSCvxjjH7+28Vwr9MyADuSYGS5mS8Q4O X-Received: by 2002:a17:902:ec82:b0:13f:663c:87cc with SMTP id x2-20020a170902ec8200b0013f663c87ccmr27172666plg.24.1634564371272; Mon, 18 Oct 2021 06:39:31 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1634564371; cv=none; d=google.com; s=arc-20160816; b=gEapErmj70TxfnwIP+VKNAb3x5i5MpLIj7sCjzHCucAqnWh49/ELTaNxC7ADKvH04d K0Cyap5JtyVNsbWHFU52QboeP3QpBhXEGnblGEA5GLfnIsHuCF4EFIGD5SKRUf+DVSXH DjLMMxd2W+0Z7I5jmtTEO6b32EpmTpU+sxEbs4IXstO5Ix+D1Lbtn7YaY0CZ3jjECfnL RlPE+cX+YkdR1aJpEKvSrphHSMzluYCfPsJccwYSNsbWxbOMAxlauISyl0xHycI8p6Zw vKMjFuRsiSEAY0RoOHsAoLoENdMQtcuTHcJrc+tTZ4bgG/wVMlP8o6q1emgJRqk7k4vg 4cWg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=wuKipqh135c1dygD3W2Ll+Bd0/qUJp3clAQLBx+Hs0M=; b=rLSBF4SGdv76PyCHGbtudRJ9QlzAVM5QjnXltcKbl4xBctDEAV1I7seaXPN9YEXHLI 0ID2de02sYj3YqSEhJvlT0J2I0jzLz4/hSbjxlKrVIfYhK7bU/fc+JWRjLqZKmVUWcOB r+irPFZT7a7fmYJ7W5xT+hwlpHn7IMO7FBJYGjm+SnNivUJRElaKZvfuXoxnd9SBeJBN Mnl3uqDo6wGgG+bfugg3WpP2kIsoL2LZzYDDRHbk+fmx/SY95EwmGKRlfX0jA9S2c3eM 43Z5h+9iViOFnRPbTNjM2hy7fszuI2gZTXLeMLvdbfZVy4y7Zjdun3nhFvfqpjwGckZK cWMg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b="y/54rh0C"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id e24si18493031pjr.129.2021.10.18.06.39.16; Mon, 18 Oct 2021 06:39:31 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b="y/54rh0C"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233407AbhJRNkN (ORCPT + 99 others); Mon, 18 Oct 2021 09:40:13 -0400 Received: from mail.kernel.org ([198.145.29.99]:54416 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233373AbhJRNhs (ORCPT ); Mon, 18 Oct 2021 09:37:48 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id 403C761371; Mon, 18 Oct 2021 13:31:44 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1634563904; bh=dxpfKwMzhPjaRIEpvbqWvz3Oiuh39b2FReTEQQlhjDw=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=y/54rh0CdWBozwPePBVMUvl63Sql0m8uWWnbJjFQyrAx0Pela57FAPmBQhDxgYlWi nZUM/rtgjLoOBjK12kwqI6tA0v1PdOJsZvkOzqojc7Envus6ecg0nuAUoELkrEtBqd mu2mcsRbYeMkv8W2WPOqEG4CvJXbCeYkTZzfguuM= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Colin Ian King , Dmitry Baryshkov , Rob Clark Subject: [PATCH 5.4 61/69] drm/msm: Fix null pointer dereference on pointer edp Date: Mon, 18 Oct 2021 15:24:59 +0200 Message-Id: <20211018132331.489294525@linuxfoundation.org> X-Mailer: git-send-email 2.33.1 In-Reply-To: <20211018132329.453964125@linuxfoundation.org> References: <20211018132329.453964125@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Colin Ian King commit 2133c4fc8e1348dcb752f267a143fe2254613b34 upstream. The initialization of pointer dev dereferences pointer edp before edp is null checked, so there is a potential null pointer deference issue. Fix this by only dereferencing edp after edp has been null checked. Addresses-Coverity: ("Dereference before null check") Fixes: ab5b0107ccf3 ("drm/msm: Initial add eDP support in msm drm driver (v5)") Signed-off-by: Colin Ian King Reviewed-by: Dmitry Baryshkov Link: https://lore.kernel.org/r/20210929121857.213922-1-colin.king@canonical.com Signed-off-by: Rob Clark Signed-off-by: Greg Kroah-Hartman --- drivers/gpu/drm/msm/edp/edp_ctrl.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) --- a/drivers/gpu/drm/msm/edp/edp_ctrl.c +++ b/drivers/gpu/drm/msm/edp/edp_ctrl.c @@ -1082,7 +1082,7 @@ void msm_edp_ctrl_power(struct edp_ctrl int msm_edp_ctrl_init(struct msm_edp *edp) { struct edp_ctrl *ctrl = NULL; - struct device *dev = &edp->pdev->dev; + struct device *dev; int ret; if (!edp) { @@ -1090,6 +1090,7 @@ int msm_edp_ctrl_init(struct msm_edp *ed return -EINVAL; } + dev = &edp->pdev->dev; ctrl = devm_kzalloc(dev, sizeof(*ctrl), GFP_KERNEL); if (!ctrl) return -ENOMEM;