Received: by 2002:a05:6a10:2726:0:0:0:0 with SMTP id ib38csp2238328pxb; Fri, 25 Mar 2022 13:39:51 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzFpEBZGr8+vzuZNMAfporXXcMKUsia4saT15B+JL+Ikj8l9Ywbu8iGv9DiL6j5Iv+1spyX X-Received: by 2002:a05:6a00:1a45:b0:4fb:1cc9:30db with SMTP id h5-20020a056a001a4500b004fb1cc930dbmr3114323pfv.10.1648240790814; Fri, 25 Mar 2022 13:39:50 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1648240790; cv=none; d=google.com; s=arc-20160816; b=MSijGFL18guEIuQmBEv2ghID/ReNg92QyvpHJ1VWckon6zVIJ6Xe1ukms95h1yYgL/ +1laV/fciMXpz7YLL2FKlRaHOuQ7E5CF8OGdQ5WuDawF+5wmJmZYQw55b9I8IinYnjwT 2T7RrJHBf/N4RZ9/ZUzxgEQKcBVjgs883PjOud5N+nkigp1MaeJgMUtQP7mJt1yyltrd L82PKcCh3GkjeaiDVlNFdqzyp/3s/kWfxawUdzdgEXeFVll8gAcXhkCbPnQ7gLAdKLcv bYY1thbdsf4bYj2Fmmt7WVvJYlE2rN1P2saaZQzDvlOWH6h2HDFkfibkzM7fiaeh8QYw JN7A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:cc:to:subject:message-id:date:from:in-reply-to :references:mime-version:dkim-signature; bh=b3WA3uEzU6evsa9NtvKVO86NocKNUHHXu3Zd9/cIBo0=; b=kak3lcc0DdiSy854r5jEKtL2FXKQUTMeZMV6e2IhqlODFoL6v/MI0PIiuxqZOi66EI FgU9+DvYYMuUTlfBKpS0eTsnauyPk7Tw4T1G/VhT9puaX67LSXqBya0082QNqNZeMRJ/ JyyJTGuO1bx50xnXafrt0KNOhUUv6Wjg2zNzZozhvZe1fhHLsVNxXxaBaNazpjYrpVWj BXNgFwF09V50FnVu1uVTmGE9UIcnt3cCCh5qZS2TSPElPCxrBicW2bGPAqqYskfzV+Yd lUffTbkTHwFsK77qMqrKMDpDLXM5GkRuxiPYAxDPm7MGu1/wFut3xM82neXF7kYXpKnZ x5Cw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20210112 header.b=N0Z1nffs; 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; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from lindbergh.monkeyblade.net (lindbergh.monkeyblade.net. [2620:137:e000::1:18]) by mx.google.com with ESMTPS id ng6-20020a17090b1a8600b001bed521b961si3555828pjb.10.2022.03.25.13.39.50 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 25 Mar 2022 13:39:50 -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; dkim=pass header.i=@gmail.com header.s=20210112 header.b=N0Z1nffs; 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; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id 4175A3B011; Fri, 25 Mar 2022 13:03:56 -0700 (PDT) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231732AbiCYUFW (ORCPT + 99 others); Fri, 25 Mar 2022 16:05:22 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:60938 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232081AbiCYUFN (ORCPT ); Fri, 25 Mar 2022 16:05:13 -0400 Received: from mail-oi1-x22f.google.com (mail-oi1-x22f.google.com [IPv6:2607:f8b0:4864:20::22f]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id DA8001FE57A for ; Fri, 25 Mar 2022 12:57:33 -0700 (PDT) Received: by mail-oi1-x22f.google.com with SMTP id 12so9285141oix.12 for ; Fri, 25 Mar 2022 12:57:33 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=b3WA3uEzU6evsa9NtvKVO86NocKNUHHXu3Zd9/cIBo0=; b=N0Z1nffsPkCsDW8eucybePw7nIKmxEn2RQyj+8YGGusGgCI74EUSK6lic+GTjL+AMM h47o9i1mNItfS19TuAoAd+64zE1Bdz0V67O4xY+/pyomOSw47HYhKRYT60uCzDKF4wXW hAS4d2dEraDZJZLYAJKsVObaxbBm5B4VNFysZ8jG6+vt/2me5u0gRXTRtfBi/j8uIH7z Ovrcxp2kQbiW9fytcMTz7nJw78c9p75dw7uK94i0PGnI1fBKyZKPBA6/jYOWZOGyfcUw jQbbcRB1NgzYq04XoxE2zLlcl25a+D8HLRI8e7ddGWxsAjQ/dprKa1QkW9njZvA4OELM D0cg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=b3WA3uEzU6evsa9NtvKVO86NocKNUHHXu3Zd9/cIBo0=; b=ITL2bp2CGts2L6PJXQyYjEQt5dFZVmdwrRuvBXyJjgwXQZFp6dAi1G6bzeiakthMV8 YEq79PpeOVnOuYfd7W6oiHAGUwCF2uPiV67f3KyRh3RBkDZtcLS2puMh4ipuSwKTEI7N JuyMT+xUNUCwxJ/+7iAJZ2rj8G1jxPJvMX7CZSPIpUIciavQJaUephiKjfPAX+DaiROQ +l+WhI4nhzj0qFYK/qw9FQqgWRFheGZOp8D49qi9pW8lB03zKwze64r5WxU2zSO4HCPZ Ub2vOrL6BpVUqJCTlOguZ+e2wK8r0n8W/kjxWPMuVJ6DKc9MrTvG8EkmyyUVMAdGXWcQ Knfw== X-Gm-Message-State: AOAM531TlOwpn2/GetLHTcA/5Yb+RaAPQm8PLj95qau0T9+8rBikznXZ IT1Fh8JARNC9a70QX7Y0GRVEakPwymBSnyDYUKg= X-Received: by 2002:aca:d04:0:b0:2ef:8b45:d235 with SMTP id 4-20020aca0d04000000b002ef8b45d235mr6347662oin.253.1648238253170; Fri, 25 Mar 2022 12:57:33 -0700 (PDT) MIME-Version: 1.0 References: <1648115162-5008-1-git-send-email-baihaowen@meizu.com> In-Reply-To: <1648115162-5008-1-git-send-email-baihaowen@meizu.com> From: Alex Deucher Date: Fri, 25 Mar 2022 15:57:22 -0400 Message-ID: Subject: Re: [PATCH] drm/amd/display: Fix pointer dereferenced before checking To: Haowen Bai Cc: "Wentland, Harry" , "Leo (Sunpeng) Li" , "Siqueira, Rodrigo" , "Deucher, Alexander" , Christian Koenig , xinhui pan , Dave Airlie , Daniel Vetter , Maling list - DRI developers , amd-gfx list , LKML Content-Type: text/plain; charset="UTF-8" X-Spam-Status: No, score=-1.7 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM, 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 Applied both patches. Thanks! Alex On Thu, Mar 24, 2022 at 9:46 AM Haowen Bai wrote: > > 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 >