Received: by 2002:a05:6a10:83d0:0:0:0:0 with SMTP id o16csp34631pxh; Thu, 7 Apr 2022 13:09:50 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwQvYl4BYIM3NXGz0Qdro2b2146D3RGYmO/tnGhTtD9S5sPO6OToP6EsrgrAI5sBvvMu/fy X-Received: by 2002:a65:41cc:0:b0:380:6f53:a550 with SMTP id b12-20020a6541cc000000b003806f53a550mr12398436pgq.471.1649362190401; Thu, 07 Apr 2022 13:09:50 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1649362190; cv=pass; d=google.com; s=arc-20160816; b=hcpqmubj62hZXU1mQIiFcfw2R+AWBhQF+5Dc4B/5rRFnOFiYemNrfdZWPqKnjfx5TU /umfBPf7FcDCZrCTubjChCcyxl29ZwWw6aQkv4iRQEMBZsGaSjaGh4K9eApOeF/P3gVA dWoebhHsOKv8aWNVBMM6GLcKpk8uyJjqqJrWfqcjqQC9QPUBcg96tp9Wp2KOCztlKBBm OpmvgACEiC4r6+9+PNP4EHsCOfJOBG5DUmbOU3fstS1/h8OcMBXtN2GnBH/Xnoa+n9nd 8Qxy+JaJl2bB20+rOHRx6aUR00QvBSL5gs9AI0hkONoVs3wLFLGyrHUeucTI0qJ7cUUS NPcA== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:mime-version:content-transfer-encoding :in-reply-to:from:references:cc:to:content-language:subject :user-agent:date:message-id:dkim-signature; bh=XgTyc2SwyvgtJXr6jHmb9texLeQnWN7NW2ejrLYrQtY=; b=MU7E8JZOVlJr1uuxXRR01kWLasWE9jh8hmc9RwjBANcvKVACvn4b5KHwuPCU1kB3ZW hZthLLIyOXf49djnznAqL4WDS9pAZ9Q2QFCd1Qh5bnkxgRxFQ3vGl4fQU8tVLYLOkpxN Og3avgJ3wu8OMMKUpFkF36TD1fs8e+TDd3KRpsC5G6HVh0lu2Ho91v8b52Z4PBFtgZtv NVPMzFzq+f8DhdI/BG8jNt37PnDDmNH0raU8zAq5+k+6ucvfSUrD/gctq6J+lJCjODoD bZYKW9eVPg8uItw7R/WH21/JiXuX8tbF6CyXMMdMEf42hwpvB0UyirGM8urjk0Lm6EPh EoEA== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@amd.com header.s=selector1 header.b=2krViFfA; arc=pass (i=1 spf=pass spfdomain=amd.com dkim=pass dkdomain=amd.com dmarc=pass fromdomain=amd.com); spf=softfail (google.com: domain of transitioning linux-kernel-owner@vger.kernel.org does not designate 23.128.96.19 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=amd.com Return-Path: Received: from lindbergh.monkeyblade.net (lindbergh.monkeyblade.net. [23.128.96.19]) by mx.google.com with ESMTPS id ng12-20020a17090b1a8c00b001c9b844880esi3010129pjb.135.2022.04.07.13.09.49 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 07 Apr 2022 13:09:50 -0700 (PDT) Received-SPF: softfail (google.com: domain of transitioning linux-kernel-owner@vger.kernel.org does not designate 23.128.96.19 as permitted sender) client-ip=23.128.96.19; Authentication-Results: mx.google.com; dkim=pass header.i=@amd.com header.s=selector1 header.b=2krViFfA; arc=pass (i=1 spf=pass spfdomain=amd.com dkim=pass dkdomain=amd.com dmarc=pass fromdomain=amd.com); spf=softfail (google.com: domain of transitioning linux-kernel-owner@vger.kernel.org does not designate 23.128.96.19 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=amd.com Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id 2518B2BA032; Thu, 7 Apr 2022 12:32:46 -0700 (PDT) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1343850AbiDGOUH (ORCPT + 99 others); Thu, 7 Apr 2022 10:20:07 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:56194 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231286AbiDGOUF (ORCPT ); Thu, 7 Apr 2022 10:20:05 -0400 Received: from NAM10-MW2-obe.outbound.protection.outlook.com (mail-mw2nam10on2051.outbound.protection.outlook.com [40.107.94.51]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 4881BEBAE2 for ; Thu, 7 Apr 2022 07:18:05 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=XK1ztRJYMkbYb0x5Qx1UURXLyi1bWA8UrHhibeeIrbCutGM7DR32p1MO6/dk74vF289EUkENO6L63hBh2E1cLYU6SG8eS8ESEDB7IXoQl9VXfQ7ONZObXKbMR7P/7mstndzEGJ6t7na4hfTh51h7Cao8e8CQBr0h573ca9LFemMtnDsGRiGAAAMirkrxFbpejOjlhQ0hSkjQqHgw1A/r8XnU1usNt89tt4Yo5udaV9KOqGXxhl/+yZTnphAH7LpZsQp900RCjhcC48akxiXETWYVHpC+q+mmhXr4s0Jn+Cb5SuMstGn5HlBS8EMvYsGiolKgGWgS8RwidIx+b8IdoQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=XgTyc2SwyvgtJXr6jHmb9texLeQnWN7NW2ejrLYrQtY=; b=MSSIvW58v69nYw01YG7P7PpCX+id4vOygsQ31aHC88HuzhoJbvig3GRHURvmxcyZRhwlt/OnYmku9d8XRHqLY+c2dSIqBmzstfddydnbFk1RqaJuZwh80LcZ7yA342Fj6a1OleK2D14iS2jr9a15koKuddrEWVyi1bhPJcvJ+9AdBq+nhw74H1E1TZ1ZYmDi239XDzrTI07N0KGVG6q3v7BkG8l4AccRtzT4d3lRIC90fvhT048v//9aMP/+fv+kzgn70BzrjHv9nxMKOi7APjgiGaYNI0LiOkDWzsmydUCSxZOBtGuh1gkD9tnWDD6l6LByJea0SG9p38hv4YWNDQ== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=amd.com; dmarc=pass action=none header.from=amd.com; dkim=pass header.d=amd.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=amd.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=XgTyc2SwyvgtJXr6jHmb9texLeQnWN7NW2ejrLYrQtY=; b=2krViFfAos689dY5XBUkCGzROzvTwutYPX0vMTCybW9TDbMoGBin4meksm9+PXNUo5sfQOtI7f/yhsBJQAU3kwgl/nm469mgQe6TaUh9BIY3I5po8sKd91klLvFr8sap67sm+rZHA/ZvPrzvFSePS3/3reHwZ3F5Zb8bSCBYniI= Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=amd.com; Received: from CO6PR12MB5427.namprd12.prod.outlook.com (2603:10b6:5:358::13) by SN1PR12MB2528.namprd12.prod.outlook.com (2603:10b6:802:28::33) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5144.22; Thu, 7 Apr 2022 14:18:00 +0000 Received: from CO6PR12MB5427.namprd12.prod.outlook.com ([fe80::61e4:a6bf:9444:31f9]) by CO6PR12MB5427.namprd12.prod.outlook.com ([fe80::61e4:a6bf:9444:31f9%6]) with mapi id 15.20.5144.022; Thu, 7 Apr 2022 14:18:00 +0000 Message-ID: <533ae31b-1794-f28b-a783-a356e9707ef3@amd.com> Date: Thu, 7 Apr 2022 10:17:55 -0400 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:91.0) Gecko/20100101 Thunderbird/91.7.0 Subject: Re: [PATCH] drm/amd/display: Fix pointer dereferenced before checking Content-Language: en-US To: Haowen Bai , Leo Li , Rodrigo Siqueira , Alex Deucher , =?UTF-8?Q?Christian_K=c3=b6nig?= , "Pan, Xinhui" , David Airlie , Daniel Vetter Cc: dri-devel@lists.freedesktop.org, amd-gfx@lists.freedesktop.org, linux-kernel@vger.kernel.org References: <1649310731-15934-1-git-send-email-baihaowen@meizu.com> From: Harry Wentland In-Reply-To: <1649310731-15934-1-git-send-email-baihaowen@meizu.com> Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit X-ClientProxiedBy: YQBPR0101CA0160.CANPRD01.PROD.OUTLOOK.COM (2603:10b6:c01:e::33) To CO6PR12MB5427.namprd12.prod.outlook.com (2603:10b6:5:358::13) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: ba5dd892-1aad-4370-95f6-08da18a16b97 X-MS-TrafficTypeDiagnostic: SN1PR12MB2528:EE_ X-Microsoft-Antispam-PRVS: X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: gx239C35bt488VlTJ0l7kEotZWYFGZ7vOa4noQ44QkMgpo40vJaAnc+jA/8FMkeVWgO7GY5BGL7s6YNTxdH32Y0LFqcN5K5nQRT5JVEJPHhVB51NQenBj0qosV7HAlXOLp/dUM+8xdtLAa1ssGgA8eZOZ7454Lpzk50LyiYtLNxfFniYXmSKgFgg184pMXLuR6+vFO9qvPYqRokYDcFclhms8sYzqn/nGMRYaPXyrSzLLDn5HpusJuN09Ld3RC7Uy2r6sRIDubkk0S2UcEo5ssPBFHIbXCnm7Dt4HE3lkFT7umFF4zeim31RVGsL6h9nAq1W7B0m74HEySfCuviv0nFHxW+45PLC7y2j1dxEfZYgnYbHdFntfMk2YAZwB+J6cQGRGzFUPV5IRtUKHSohzzUKM+u+/VaPzJwEWtAf57QnUutLHcf101jmxGD30A8gepECZ3Y9IVI/V5rQR2XzsbfjOmYsRf0AjL6TuS8Yck+gyEHE8UqFMQYbmM37Rl/9ho1VmEdGuIYQv8zvR4qcih62V6mF7x9j5X/aOq2sjbQQEgbCAOuc0Hsu4hx3AjbnzOdzaDDX2ymAITORAylrMpiYx8Twiclg5mSDAknLiYoZmclx5uxkElh9QlWdWitEHhahIRrM3GHkKr4g3/OWJ2CD4veV/b0V6VjkwA+18EeoOwqg247uQhN3qw7GsAhmyTx2CBrYNrKhFwuDVnTUj5jzKJiwQTgXApBn2kokLLE= X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:CO6PR12MB5427.namprd12.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230001)(4636009)(366004)(31696002)(38100700002)(86362001)(5660300002)(6486002)(36756003)(66556008)(508600001)(316002)(8676002)(8936002)(4326008)(110136005)(66946007)(26005)(186003)(83380400001)(2616005)(31686004)(53546011)(2906002)(6666004)(6512007)(6506007)(44832011)(66476007)(45980500001)(43740500002);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?utf-8?B?TndyV0M4eTJWVVJJUkU2WGdDWmtuZ21hZWJoNE56TUhaMG4yNU5RcEM2WW1a?= =?utf-8?B?M1pWMnJieVlLL3VuclBWdUd2TUpGOGEzZ0RTZGJHOXRYRkJ6VWVRckNTRC9G?= =?utf-8?B?QjNqVFlNRUFySEllempxSHFUZ05HUStRTTFTK0pqTEtqcXFYbzI5RmJnS2xt?= =?utf-8?B?d3dlOEQ1eVBoblNKQXdlV2R4TnFUSVB4TjVwRGlMMENuRGdEMG9YMFVXMlNF?= =?utf-8?B?TDFHc29sL3ZGSjRvOXBxcnU4MzRnL2U3K1hpNWhUbm9WcEFuNEFod29SSjVP?= =?utf-8?B?QUVrbVlLNk16TklsS3pwSjR5dWQ1NVhqaWZaZDRGV3lqV0tnMEdqSmZHNTBY?= =?utf-8?B?L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5TFIvTHBQQ3VPZktQT0RmSGV3dnZBekZheUhwN3ZT?= =?utf-8?B?T1F0Z20ydW03aUEzOGFiQUs5Z0JzYi9EbjNvTm92ZjJINmRkd3JBdG5seGZi?= =?utf-8?B?NllYNDhvWmpESWZjM3NjQUVENjc3bE1rc1QzYjJuUUZqbHFHV1gxb3FlRmhk?= =?utf-8?B?QjRUQ3pQdDEyd2RtMEg4c2I3Vm4rdDEyS1g1ZStjTGdxSnFzN2k4QT09?= X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-Network-Message-Id: ba5dd892-1aad-4370-95f6-08da18a16b97 X-MS-Exchange-CrossTenant-AuthSource: CO6PR12MB5427.namprd12.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 07 Apr 2022 14:18:00.2431 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 3dd8961f-e488-4e60-8e11-a82d994e183d X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: iOuB2ltnvS4Dewoj99s3w1wZ619TqUISz/AB+8z2wlCq2S+pVOV+5evDj5o/IIF8sD1sPZdOw1g4ymQfHsUoDw== X-MS-Exchange-Transport-CrossTenantHeadersStamped: SN1PR12MB2528 X-Spam-Status: No, score=-4.8 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,NICE_REPLY_A,RDNS_NONE,SPF_HELO_NONE, T_SCC_BODY_TEXT_LINE,URIBL_BLOCKED autolearn=unavailable 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 On 2022-04-07 01:52, Haowen Bai wrote: > The pointer dc is dereferencing pointer plane_state before plane_state > is being null checked. Fix this by assigning plane_state->ctx->dc to > dc only if plane_state is not NULL, otherwise just NULL. > > Signed-off-by: Haowen Bai > --- > drivers/gpu/drm/amd/display/dc/dcn10/dcn10_hw_sequencer.c | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) > > diff --git a/drivers/gpu/drm/amd/display/dc/dcn10/dcn10_hw_sequencer.c b/drivers/gpu/drm/amd/display/dc/dcn10/dcn10_hw_sequencer.c > index 50820e79d3c4..ee22f4422d26 100644 > --- a/drivers/gpu/drm/amd/display/dc/dcn10/dcn10_hw_sequencer.c > +++ b/drivers/gpu/drm/amd/display/dc/dcn10/dcn10_hw_sequencer.c > @@ -3211,7 +3211,7 @@ void dcn10_update_pending_status(struct pipe_ctx *pipe_ctx) > struct dc_plane_state *plane_state = pipe_ctx->plane_state; > struct timing_generator *tg = pipe_ctx->stream_res.tg; > bool flip_pending; > - struct dc *dc = plane_state->ctx->dc; This has worked for years now, meaning plane_state is never NULL here. It might be better to drop the NULL check below. Harry > + struct dc *dc = plane_state ? plane_state->ctx->dc : NULL; > > if (plane_state == NULL) > return;