Received: by 2002:a05:6a10:5bc5:0:0:0:0 with SMTP id os5csp3009965pxb; Mon, 18 Oct 2021 06:32:41 -0700 (PDT) X-Google-Smtp-Source: ABdhPJygpXrZPigr4VM5klCDZ8Q/aHkDwovXotquWSb+cW14MvqO+2s8VWLAQfvqLa1LcnPPfu36 X-Received: by 2002:a17:90b:1b42:: with SMTP id nv2mr33388140pjb.91.1634563961007; Mon, 18 Oct 2021 06:32:41 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1634563961; cv=none; d=google.com; s=arc-20160816; b=YPJXxtTPnZJ5UFk22P8HOi0FAiicxSpmujzbE6ybtQQQ1wG2ybY7rEPHEkNHDGTiEz K37Quc2J71H2I7aAtFE4bdXF0E/aN4h81HR7PCrSy+huP86cznfdM1uwRnmBm0evHzf0 DS8HGYofG+TZ5qSGeKH4qlH8gx4tx2f4NKejnvC4rKyJeoiEfr0JLrNW/G/1S+Mh+FKa LFCLBaLF1N0SLKWCbglhs75GKt0xkii3VyUrs7Uui2EA4HG5gvm0lMXh0ai5/SNWy+7W Gyt+8fLcQEyXdUu6wIFxaHJhPvTmnoV6SP2gWTmL2wij6NcIyiJxLIWW8zoy/YjyCpyM x7yg== 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=u0l9JI9zy8G9KrAMGG1XmQJ7mo8qn4Mek/VpFXn+9JI=; b=mA1YMD4sSgwjRBMY63x1NUQu36hpJO3vSMwYTFpM1RiQfflc0KM5pHkUIeHHPSrnpb VF+foTSl7SL7atQxcM46TSt2GRF1uFhrFTl8SV4O4YqMl1r7KAvusBWKLuf1It9QPa9M GL451U+vB1r5cC6V1MwxKbCJavjTl3n+VxEOvHHwJUzbaYNAMva1dlh4s1123sLCE7uG j9igILw4w/IwluGxuLwl61i1drSR5VjTA/GVbRpuOQr01BLtUrYd9ovf9pOznIUh95B5 tLGga2zVGFTZ9ilkhnClT2B1TR20QgB9qPBZ3nkuo0Po1Tczw2TMRb2km/s6ag8uBcnn sE9Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=t1w2BjXI; 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 oo11si30509973pjb.9.2021.10.18.06.32.27; Mon, 18 Oct 2021 06:32:40 -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=t1w2BjXI; 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 S232425AbhJRNdh (ORCPT + 99 others); Mon, 18 Oct 2021 09:33:37 -0400 Received: from mail.kernel.org ([198.145.29.99]:43996 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232943AbhJRNb5 (ORCPT ); Mon, 18 Oct 2021 09:31:57 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id 532B36128A; Mon, 18 Oct 2021 13:28:54 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1634563734; bh=DkzIO5A03SRxsi4IHh9zWKcpfsQxM/uye2P9HevFwXU=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=t1w2BjXI+QLk3RK4jI6X8E4BuP5igk6MlwPBEyqLNT282DLAbJYNVfFQFU6jPdgd9 Jjqr8Z2eUCURLYgF87CLT8Yjpmua9IPyvzHJuK21l2b5Cbr0fYg+3diqd44iWqIfJ9 1yOVee3UekUNc/8kUjECkWRfND0a1qkE5RfSNVMI= 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 4.19 43/50] drm/msm: Fix null pointer dereference on pointer edp Date: Mon, 18 Oct 2021 15:24:50 +0200 Message-Id: <20211018132327.942629074@linuxfoundation.org> X-Mailer: git-send-email 2.33.1 In-Reply-To: <20211018132326.529486647@linuxfoundation.org> References: <20211018132326.529486647@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 @@ -1090,7 +1090,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) { @@ -1098,6 +1098,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;