Received: by 2002:a05:6a10:2726:0:0:0:0 with SMTP id ib38csp2221635pxb; Fri, 25 Mar 2022 13:19:31 -0700 (PDT) X-Google-Smtp-Source: ABdhPJx/tx+R9w7VReUdyowE802hloLhG58fEjyuGJ2T1FaSFcZtDAthvzUa3UVZN6l8YrNBhwfR X-Received: by 2002:a17:902:f605:b0:154:aa89:bd13 with SMTP id n5-20020a170902f60500b00154aa89bd13mr13639868plg.112.1648239570969; Fri, 25 Mar 2022 13:19:30 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1648239570; cv=none; d=google.com; s=arc-20160816; b=bagh8N6WAk8BcSu+p37N03N6kp7I9vXynKlYjqZuXSP2DK6skCuZgD97bAoAZiwqU3 XX+QC1cqMlMEAFz4rwHXD1cblGjTqtWUHHNbWJ2UMlgnMvVjrGF84rRzP1wv0+RchuJv 9CcuGO7xAxGBW0gVaJtahX0z5pOT1ZsNyyvAKZuAhY6ptLAIuT36pbRzMn4DXinfoOSv aRME+pLPjWF0bNN5z497hGdShAceEAAa1mbFzAFANDasif9twMsdQRtTvrkauyRbVklY fR63yTrviQ886ry2VC0F9GMkbCeV2ALjVxywFU2Arb6041oByZSY0mxQxMeGfNryEY7t fqnA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:mime-version:message-id:date:subject:cc:to:from; bh=o26NNH1BZkDco1+NSa64ONQV41Rs/2YWIpmG+Gmu1Xg=; b=r+iKWC1+ZfCijYLqb7oV/UrGDHGnCS0Z1cJCs/xttUQGtaAsBli9H+2/BYD3X6fThI QgY5CrLkUXp2AQrlakWHeq5hvOIiu2vf6ed9YldX8KkANvPxeCMjAH6faSQY1vOlmOLt 19NP2+I4ISoYiOScxA/D1BUMWptJ5qjDz/W/HnkAcBNqStQPBjldJR6te3pigFb5N85/ d7YOBY6cdylP1mbjU+F6NdBskbGr7h5pFcJ8m4qlR/Ebyduo74nK8ZMBfX43nMIik+bx Ag4OgD4CJGyQ4XiWUEMDrUf+q6jTQV1WqwPAyDXQKrg4akX5JAlTz5FwNAz5w7V6vcdy gL+g== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from lindbergh.monkeyblade.net (lindbergh.monkeyblade.net. [2620:137:e000::1:18]) by mx.google.com with ESMTPS id oj9-20020a17090b4d8900b001c6d9f0dcdcsi7240748pjb.65.2022.03.25.13.19.30 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 25 Mar 2022 13:19:30 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:18 as permitted sender) client-ip=2620:137:e000::1:18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id E148A37A902; Fri, 25 Mar 2022 12:16:02 -0700 (PDT) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1349337AbiCXJrj (ORCPT + 99 others); Thu, 24 Mar 2022 05:47:39 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:38742 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1349239AbiCXJri (ORCPT ); Thu, 24 Mar 2022 05:47:38 -0400 Received: from mail.meizu.com (edge01.meizu.com [14.29.68.187]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id E143D9BB84 for ; Thu, 24 Mar 2022 02:46:05 -0700 (PDT) Received: from IT-EXMB-1-125.meizu.com (172.16.1.125) by mz-mail04.meizu.com (172.16.1.16) with Microsoft SMTP Server (TLS) id 14.3.487.0; Thu, 24 Mar 2022 17:46:08 +0800 Received: from meizu.meizu.com (172.16.137.70) by IT-EXMB-1-125.meizu.com (172.16.1.125) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2308.14; Thu, 24 Mar 2022 17:46:03 +0800 From: Haowen Bai To: , , , , , , , CC: , , , Haowen Bai Subject: [PATCH] drm/amd/display: Fix pointer dereferenced before checking Date: Thu, 24 Mar 2022 17:46:02 +0800 Message-ID: <1648115162-5008-1-git-send-email-baihaowen@meizu.com> X-Mailer: git-send-email 2.7.4 MIME-Version: 1.0 Content-Type: text/plain X-Originating-IP: [172.16.137.70] X-ClientProxiedBy: IT-EXMB-1-125.meizu.com (172.16.1.125) To IT-EXMB-1-125.meizu.com (172.16.1.125) X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00, HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,RDNS_NONE, SPF_HELO_NONE,T_SCC_BODY_TEXT_LINE autolearn=no autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org The value actual_pix_clk_100Hz is dereferencing pointer pix_clk_params before pix_clk_params is being null checked. Fix this by assigning pix_clk_params->requested_pix_clk_100hz to actual_pix_clk_100Hz only if pix_clk_params is not NULL, otherwise just NULL. Signed-off-by: Haowen Bai --- drivers/gpu/drm/amd/display/dc/dce/dce_clock_source.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/gpu/drm/amd/display/dc/dce/dce_clock_source.c b/drivers/gpu/drm/amd/display/dc/dce/dce_clock_source.c index 2c7eb98..4db45bb 100644 --- a/drivers/gpu/drm/amd/display/dc/dce/dce_clock_source.c +++ b/drivers/gpu/drm/amd/display/dc/dce/dce_clock_source.c @@ -1162,7 +1162,7 @@ static uint32_t dcn3_get_pix_clk_dividers( struct pixel_clk_params *pix_clk_params, struct pll_settings *pll_settings) { - unsigned long long actual_pix_clk_100Hz = pix_clk_params->requested_pix_clk_100hz; + unsigned long long actual_pix_clk_100Hz = pix_clk_params ? pix_clk_params->requested_pix_clk_100hz : 0; struct dce110_clk_src *clk_src; clk_src = TO_DCE110_CLK_SRC(cs); -- 2.7.4