Received: by 2002:a05:6a10:5bc5:0:0:0:0 with SMTP id os5csp3035789pxb; Mon, 18 Oct 2021 07:03:25 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyl32+lhm5pVr9H4rljtHkitDzKglyM5RTFZlXyBuhDeHb/wD1t0zA3t++qN/tZkPVO0uts X-Received: by 2002:a17:90b:4b10:: with SMTP id lx16mr33443082pjb.217.1634565805217; Mon, 18 Oct 2021 07:03:25 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1634565805; cv=none; d=google.com; s=arc-20160816; b=bjfPiqSxdY1PiN7zplSJ4yChwG0PT+gTv0ACMJblY9kG6qwm36e2mjrG6Qo9bVvU+t 4Mtj0RFtDIFBuTUFlKm+b9dbHtOXTrVXCMDFKWn3ePLd94OFZUii3F89KzC5NJRP+iTQ H8RdmM10z/vr0EwfI3dNh20bN1U7Al2XzdvOV7lJcJ+OT/aRdIMBJO+4mt4iic2Qf0sg qf1hFJOyQMCoH1YhRZeQxP1FkgO7qVeZ2M/yPLnncSOgybrJPAEynslKg9LTxVQSZhIX 6zFYT24o3fjgXNCkwXgEVFBtuqRfyk889+r0qWxnD7jY0+LK1Xx3cznz7OZuBS//U0Su xWkQ== 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=7JgHO6tcn0fMxjAsXsmkmyD+WqiFaFh5JbSBQG0YcJ4=; b=qdmHRiO6hhVLVrS7yKXa0kdiKChw7RL2cTvj9z0N6dEKiQ/B97Dgk7f4B3YtwzE49a ntMgz0hNJo7HNP6uiClPCuYvvw/hhdxaDcfrRU91+7nMNSR3hKhn2IJlyq93PoBHwQll 0BVAt9D+KOtfwRuaCOKzX2uShsc87br8OXyzUfUc7ZQE2VI2hlK/Fz6WyYqnw8s/gWiD 8CNhrXYzOLhhHExJOkd9+bOIly0H47s9tgQG4EcjTN0zpV5ugVfoK6r48w0CbXSIjB77 i4H0V2vjnAjmOX2+UIU+XVHuJ02atNwct+MGncSm8k4HIS1r+f72q7DkPGmT7wmy9yqu YmCw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=gtLnfIoL; 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 e18si25447536plh.102.2021.10.18.07.03.06; Mon, 18 Oct 2021 07:03:25 -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=gtLnfIoL; 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 S234552AbhJROCf (ORCPT + 99 others); Mon, 18 Oct 2021 10:02:35 -0400 Received: from mail.kernel.org ([198.145.29.99]:38242 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234544AbhJROAa (ORCPT ); Mon, 18 Oct 2021 10:00:30 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id B5E586058D; Mon, 18 Oct 2021 13:42:18 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1634564539; bh=RnTKsBJzNHDVtnKE56ENXLz4MomONE8g6IMKWUNhBgY=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=gtLnfIoLbCOuS2OYXqTomJeZc2nbQ4cWb9RIXWflfoDKKywx/uJZLltqN6YofBRtw jek+WSFUAbeszHxv658efarb/4yGZM7nUX4YIdmlJzpy3fHXT1L6ZWga6C8zNhOxgU 8wu322hPrlTZsO7J3e8eXha79eUDzgbnZWeU76fI= 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.14 127/151] drm/msm: Fix null pointer dereference on pointer edp Date: Mon, 18 Oct 2021 15:25:06 +0200 Message-Id: <20211018132344.799716412@linuxfoundation.org> X-Mailer: git-send-email 2.33.1 In-Reply-To: <20211018132340.682786018@linuxfoundation.org> References: <20211018132340.682786018@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 @@ -1116,7 +1116,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) { @@ -1124,6 +1124,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;