Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 8FB21C433F5 for ; Thu, 23 Dec 2021 15:53:32 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S244531AbhLWPxc (ORCPT ); Thu, 23 Dec 2021 10:53:32 -0500 Received: from mail-bn8nam12on2087.outbound.protection.outlook.com ([40.107.237.87]:1759 "EHLO NAM12-BN8-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S244501AbhLWPxa (ORCPT ); Thu, 23 Dec 2021 10:53:30 -0500 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=jhvEYu3JYhSjrZEeXX55L8iBf5im9VJh2SyNRuJui8WtRFO3aVC7EToIXrSv8lXcvvPaIpdwdy1RYJSp/uvnu9nrAQuCLiTWVyakPYz48RjLmb1x19GlpnExu3iBSSHUwKRl0mQ0eKLgXWj265L2VoI2lAwzQxbT7NZJQCzZGt8UdOdUBF9+e4dl4ASEoEG1vJiec2lbte684+c+tJwJWmrmX/tQmzx/XoPmqhKBx3fpfr1uUmjhB2lKBXGIXuKXd0UDbQe1yYHGkv7DG+RVxHKVgntTJWw958T6NSAdHpNN+upoRUoWl+rAyHKVW3HMaxIsla4HSnJR7OJDHXjChg== 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=KOBIEYlsGbPAb9XnBFuVS74eBO2nShucx0pLW3gw6ks=; b=AJ7g3vJBLsPpfXIXxMpTdDkTl3mgULzVVOEvr2I6m/SqKaChl7oJqEAfSe+NUECqPnuwWYHauq3+oN4plJPeKSjBYEULUlfhLUlzmOp5a6oqx66PDB3BAPSVrTY+LJ7FIyKZTfBhZ+aYccvyr26SbXJnFSRxCB0P9MzbKJj4501UG609VTNQEjpX71vXYglFPe4jcZ4wEtC+w+Y51JWZ/NsAUIZ779RYvELFfa/tU8kkH5NZecxvq68rbTVW36bdvNIqBc3fqwsyjf/p8aZWXxwoeStnpjdwBKXs6hO1Oo3rDsmw8U0BkdV/sdTpde+CjfDvfhtAMX1Kcyaei73T8g== 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=KOBIEYlsGbPAb9XnBFuVS74eBO2nShucx0pLW3gw6ks=; b=SXlQqwWUClms5ZmBkEgLfjb6tYupTTGeQR1SylQrRy1Vqf2TSKrbTn64ToJkhsaYV4Ur/ruLem++vUab0IVs7UWMR0v4JBHBK8tBvb8Gc3tjsWqn5yTFrVYc8/mRSh+w37u1ofN5F9PXY75YXXcLSNMV9N5Bov58iOgpeN/CoTE= 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 CO6PR12MB5492.namprd12.prod.outlook.com (2603:10b6:5:35d::15) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4778.17; Thu, 23 Dec 2021 15:53:28 +0000 Received: from CO6PR12MB5427.namprd12.prod.outlook.com ([fe80::e492:c86b:9906:1b46]) by CO6PR12MB5427.namprd12.prod.outlook.com ([fe80::e492:c86b:9906:1b46%7]) with mapi id 15.20.4823.019; Thu, 23 Dec 2021 15:53:28 +0000 Message-ID: <5bc5dd90-fbf7-e999-8024-1269eeb78b93@amd.com> Date: Thu, 23 Dec 2021 10:53:23 -0500 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:91.0) Gecko/20100101 Thunderbird/91.4.1 Subject: Re: [PATCH] drm/amd/display: fix dereference before NULL check Content-Language: en-US To: =?UTF-8?B?Sm9zw6kgRXhww7NzaXRv?= Cc: sunpeng.li@amd.com, Rodrigo.Siqueira@amd.com, alexander.deucher@amd.com, christian.koenig@amd.com, Xinhui.Pan@amd.com, airlied@linux.ie, charlene.liu@amd.com, amd-gfx@lists.freedesktop.org, dri-devel@lists.freedesktop.org, linux-kernel@vger.kernel.org References: <20211216181443.38155-1-jose.exposito89@gmail.com> From: Harry Wentland In-Reply-To: <20211216181443.38155-1-jose.exposito89@gmail.com> Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-ClientProxiedBy: YQXPR0101CA0015.CANPRD01.PROD.OUTLOOK.COM (2603:10b6:c00:15::28) 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: 02f39b6e-1299-4262-e02a-08d9c62c5c40 X-MS-TrafficTypeDiagnostic: CO6PR12MB5492:EE_ X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:5797; X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: qigGkhnQT7oGGDe3Sllvw/HM4wC0ghh17PsgPJYpqoBorY3PBRv6GhIYfaosq6tbC1YVYw5pqQoG3Q1GJQtXU7sTAbC+Gif1Vj9mU48oQ7FvMqFSpvShkTHV9NdsJSfpCdCHwuTobIEpb5gz8bc7P+bD/hQB6kcWsmQMOTdqEkPoIIOGc/L2rGLjVKUtqr/m1MDSTd9jteL0Hup3I/1m7hDrKQrvOnZ0NTIVB4zhP5Cv5Y0byWh5NxareQ5cH4j0CMxnyxjGu62uJOeb9FeFegR+P0OJQdUEL1Y8cF90bEMFK6EV0WGFQtUc/WWS7uQ4T0OIbYJnlPTfxWng8csrN2FlZUPS4viihG04HuYDBMnS50beLaZ/kBinzS2c1X0FKqhwaXgfgY4YVtvomLu3jaBYtBoeZY1vSUxlJOsquoln0IqWt3ht/C4tjBOcxJQ7R5uL1KfY2Eac1AWCj909WtzVY0XDRsHHTvr/Xyce5PZBIaIy5H+KUwqMaSs3v77qWPnXgAp2+LahdqV+af1PDow3gWTHatRqeJaa/3l/uGJcl21i3mRjMpOFgwhfYB+VyvZPGmhJjnOqXA98bwU8KBqyag9bNVhib5+SkDe+lAefFnNHwX+sNFn9RCVQaEQjF++R8tHxnJ8FJMH+AnVepbGIFvs2pkJN4dGDg9wsmGoA0yk19K1o89MCb2fGelLaCxXtodfMnnyXSsYnmU1AsypkOylSbKWNyJolaMV/Yys1BD/FXtNH2cfB9LPzihML 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:(4636009)(366004)(316002)(66946007)(508600001)(186003)(6512007)(36756003)(2616005)(44832011)(5660300002)(6666004)(8936002)(66476007)(6486002)(8676002)(53546011)(31686004)(6506007)(66574015)(4326008)(38100700002)(2906002)(86362001)(4001150100001)(26005)(31696002)(66556008)(83380400001)(6916009)(43740500002)(45980500001);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?utf-8?B?UlRrY25CdGV6dU1XZmlucXB2ZTdEVTArK2xQM1lIQm5vbXdRVHIxVnY4cjhK?= =?utf-8?B?MGFtTk16T25vTmtDK3prMUZENVFYaEdSemVXSm4rZktOL2o2NjVtTFp4Zkg3?= =?utf-8?B?MGZyMGF2cWpqT0docUFLRnppV0w0ZDdJ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?SGdiZGd5aytKTU9xTGVUUTVoS3JCWXpUbUg1Tmk3cmtjMWJ3UWRwY3JWR1NN?= =?utf-8?B?S0NYeFovelBlb3lhZTRGa3UwVytLNWVMZVAvMVFBS2NsTURiSGRORGViWlVz?= =?utf-8?B?V0d0MSs0dkNZOVY3N0QzRmpYT3ZwTmN5STFzUTB5c21WeHRubm9sTDVjUXA2?= =?utf-8?B?cGZCVHpYMHNwWUNvdHlpem1Rb3BoRjdxZFh2ZlliNEZqY2dRdWJOMkZzYk9G?= =?utf-8?Q?wO4Z1nstTJ37pFjWpMJfEfg=3D?= X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-Network-Message-Id: 02f39b6e-1299-4262-e02a-08d9c62c5c40 X-MS-Exchange-CrossTenant-AuthSource: CO6PR12MB5427.namprd12.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 23 Dec 2021 15:53:28.0780 (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: Vg/Y9GrEtrEgrwL8SQuavrdDhkBCqi78Knreia5tdJB7l1txSSm2HiMK2RRj6pXm7M3BYER+Ntk+X9s2FfTw3A== X-MS-Exchange-Transport-CrossTenantHeadersStamped: CO6PR12MB5492 Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 2021-12-16 13:14, José Expósito wrote: > The "plane_state" pointer was access before checking if it was NULL. > > Avoid a possible NULL pointer dereference by accessing the plane > address after the check. > > Addresses-Coverity-ID: 1474582 ("Dereference before null check") > Fixes: 3f68c01be9a22 ("drm/amd/display: add cyan_skillfish display support") > Signed-off-by: José Expósito Reviewed-by: Harry Wentland Harry > --- > drivers/gpu/drm/amd/display/dc/dcn201/dcn201_hwseq.c | 3 ++- > 1 file changed, 2 insertions(+), 1 deletion(-) > > diff --git a/drivers/gpu/drm/amd/display/dc/dcn201/dcn201_hwseq.c b/drivers/gpu/drm/amd/display/dc/dcn201/dcn201_hwseq.c > index cfd09b3f705e..fe22530242d2 100644 > --- a/drivers/gpu/drm/amd/display/dc/dcn201/dcn201_hwseq.c > +++ b/drivers/gpu/drm/amd/display/dc/dcn201/dcn201_hwseq.c > @@ -134,11 +134,12 @@ void dcn201_update_plane_addr(const struct dc *dc, struct pipe_ctx *pipe_ctx) > PHYSICAL_ADDRESS_LOC addr; > struct dc_plane_state *plane_state = pipe_ctx->plane_state; > struct dce_hwseq *hws = dc->hwseq; > - struct dc_plane_address uma = plane_state->address; > + struct dc_plane_address uma; > > if (plane_state == NULL) > return; > > + uma = plane_state->address; > addr_patched = patch_address_for_sbs_tb_stereo(pipe_ctx, &addr); > > plane_address_in_gpu_space_to_uma(hws, &uma);