Received: by 2002:a05:7412:a9a2:b0:e2:908c:2ebd with SMTP id o34csp1257483rdh; Fri, 27 Oct 2023 08:54:14 -0700 (PDT) X-Google-Smtp-Source: AGHT+IGvVSkwxiwqLuUrzCHNgVk5jlvcd8uUCiBgmr6buJO7KuSUAi/pNPAiyiiw9fNjna/H1o5B X-Received: by 2002:a81:b61e:0:b0:579:f5c2:b16e with SMTP id u30-20020a81b61e000000b00579f5c2b16emr2748941ywh.31.1698422054086; Fri, 27 Oct 2023 08:54:14 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1698422054; cv=pass; d=google.com; s=arc-20160816; b=oTaEuWv+J8pLpepCMrGrBcYrpnZoG8oBw2p8no4ANhUae122UDD4I+wjw02ORh9+Uq B8yYXzj16OJNZnKmmItq/lI7ru/5rHeEtLKpSQEiZRdpOrzLDgl5n8duyI3AlQu7hfcZ /4UD42sESwMtSlGhnnJ9fc70d3Z+CQNprF6jb6xwhEMLpwyCm2f5/HMt3OeCKGEoaz6d dt65KtZN3Vgj+F1OmQqPYp2seucHnmvb30uxHuo0YIFlqTn52V8PiSCI1RcSNMly1vEz dJEkhndSWM4sOKGyY5kAoRgSUWbxxljKEku959i2apdgGFdl5G7iuhAy8Jd5b4KJb5xL xbAw== 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:references:cc:to:from:content-language:subject :user-agent:date:message-id:dkim-signature; bh=J2HJuJCrVH9NRO86esRGOSYRmmcGOUPQ88kEGe4vSdA=; fh=14EWmenHvz8EgmRDDSyn9ZuufRwBTeZCyHz3+ReWGdA=; b=JjWfuXJxucQEOP27QmQ8TFe/7coLixqWk6C6xYwOEPf54V/252AmOgWxgyjFxzmyXz gjsQCwcBjicCQbJqchJtpi5aGq2m/kB+G0trg4LB9IvCYtWmJ8gKVhnQNs0ioMzuqoyK e9E+xt4mICJlUlNCurDP5YuuTvpaZRK89M8f4Dg8lCwv59yh+3UsxsBzOyRP4Pcu5n61 kdxIFrpDnF8TTMaSSSt5zd8F6G8IuXLPhmLFVkNd9ceu/Mnq3ZzjeADVf34OODPwi1Nq RQLPJKoPMS8+0qx4A3Q8TyB3xGRh09AKaY1ZBA5XAgTY+dncJ2VK75k9O6eijwKB4pUe jH2w== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@amd.com header.s=selector1 header.b=4Me7Uj4N; arc=pass (i=1 spf=pass spfdomain=amd.com dkim=pass dkdomain=amd.com dmarc=pass fromdomain=amd.com); spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:6 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 pete.vger.email (pete.vger.email. [2620:137:e000::3:6]) by mx.google.com with ESMTPS id d68-20020a0ddb47000000b0058dd3160fa8si3018708ywe.0.2023.10.27.08.54.13 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 27 Oct 2023 08:54:14 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:6 as permitted sender) client-ip=2620:137:e000::3:6; Authentication-Results: mx.google.com; dkim=pass header.i=@amd.com header.s=selector1 header.b=4Me7Uj4N; arc=pass (i=1 spf=pass spfdomain=amd.com dkim=pass dkdomain=amd.com dmarc=pass fromdomain=amd.com); spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:6 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 out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by pete.vger.email (Postfix) with ESMTP id 1FBA8834BA71; Fri, 27 Oct 2023 08:54:11 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at pete.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1346289AbjJ0PyA (ORCPT + 99 others); Fri, 27 Oct 2023 11:54:00 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:52966 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1346223AbjJ0Px6 (ORCPT ); Fri, 27 Oct 2023 11:53:58 -0400 Received: from NAM02-DM3-obe.outbound.protection.outlook.com (mail-dm3nam02on2057.outbound.protection.outlook.com [40.107.95.57]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 4D60D186 for ; Fri, 27 Oct 2023 08:53:56 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=RYyXF3d23qiuwFsdsK4/oymUyWVuWILhHZtMlsSbNBT5eWd+3M50Y8mqrAGpG+lrwKvmQZo+OqohmRkCBIbf21dTuic8WR3zj4tAavobT243pEgPLUQQb1YqAKUXMx+zZcHjy77QgoT/F6xShQhRupxObfMR9cPZ/sDPJWHBQKDJfRN8bvaabWwI/HvNAbFP4JApAq9zuLVP8sfXjM6gHBwp/6Dq6/cvldoEIr3V9rq69dnknJ3epMg2BAjss61hVejWwLf2Cj6JABPY6bARotaw5RbSEGMX2e6yDCljwH0BZhZ4D685X+Zq+RPt0SOMG6WyKJz2USbqsjnEjKvvzQ== 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=J2HJuJCrVH9NRO86esRGOSYRmmcGOUPQ88kEGe4vSdA=; b=O2VfwZ5OukVzpcFv0AvPlUhv5Flm7/PFRatwcZnDNzSb5rqOHjZZVoApJymSO3Ps5OpKDX26atnbpxXTeijtquRxPW0AhcgIO/kxI3iDFNTj0u+qHNeRBjjwHuhbNXqCtnGGZ8MK2EW2ikQWSC6WgJIVxV0OpkLcg79XHJtMNOqfgln5xPUveyF9hc5pe8Fv+/xwObQW+KqgHgBDPSw6c/ZNxjkF+FLAOuTXowiuDgKQZMNQteNgwsvZ5hM0xuYr7gA67nScBFYH3trdIFQDaYLppNq0YCzTPnS55IYs0UGHmAhMmIKrAkMezQfLtjUdgyyiRmJdWmbn35e3h9K4PA== 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=J2HJuJCrVH9NRO86esRGOSYRmmcGOUPQ88kEGe4vSdA=; b=4Me7Uj4NGxfDu0xGM3V0L9CRZmUzEvkYxEbGKYHSsEPbNrzwfmrWucIRTs/0QSBy8ziDxSgyHmVVmM3R1MfIqymORoXRX4Tlirb11GSFBtBGxWUdczrrD8CJ9iauiL9w/wtGBEfdhmSEAVSjR9mHm+yA+eUlicohCQwD2ArDzoo= Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=amd.com; Received: from DM4PR12MB6280.namprd12.prod.outlook.com (2603:10b6:8:a2::11) by DM4PR12MB7528.namprd12.prod.outlook.com (2603:10b6:8:110::17) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6907.33; Fri, 27 Oct 2023 15:53:54 +0000 Received: from DM4PR12MB6280.namprd12.prod.outlook.com ([fe80::5588:7117:d54e:9466]) by DM4PR12MB6280.namprd12.prod.outlook.com ([fe80::5588:7117:d54e:9466%7]) with mapi id 15.20.6933.024; Fri, 27 Oct 2023 15:53:53 +0000 Message-ID: <1c88d721-75ea-4c3b-9e50-706c4ec87899@amd.com> Date: Fri, 27 Oct 2023 11:53:52 -0400 User-Agent: Mozilla Thunderbird Subject: Re: [PATCH] drm/amdgpu: Fixes uninitialized variable usage in amdgpu_dm_setup_replay Content-Language: en-US From: Hamza Mahfooz To: Yuran Pereira , airlied@gmail.com Cc: sunpeng.li@amd.com, linux-kernel-mentees@lists.linuxfoundation.org, Xinhui.Pan@amd.com, Rodrigo.Siqueira@amd.com, linux-kernel@vger.kernel.org, amd-gfx@lists.freedesktop.org, dri-devel@lists.freedesktop.org, alexander.deucher@amd.com, Bhawanpreet.Lakha@amd.com, christian.koenig@amd.com References: In-Reply-To: Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit X-ClientProxiedBy: YQBPR0101CA0284.CANPRD01.PROD.OUTLOOK.COM (2603:10b6:c01:6d::23) To DM4PR12MB6280.namprd12.prod.outlook.com (2603:10b6:8:a2::11) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: DM4PR12MB6280:EE_|DM4PR12MB7528:EE_ X-MS-Office365-Filtering-Correlation-Id: 2b6797af-c04e-4c09-6af5-08dbd704ebc0 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: lvco4FqklP4QKv1VrlmnDEMjBIvvDyzk5aFUpjNLHlkw0RKHF5/+wpXpG2gSZn4XdHf3ys0T9bEXfEw7nuaPt9XTB+RNvqGWNGY/CUvUhjM6CuULpPu+R/aMK2hO5/R8FEfBM21bOEr+zEwgECs8uK7YXXVVilS6/kFjmm939E0scYJKNTcVbon5cysFoBFC8sKHTgr0RpZcWsAmsIbLfv54UB4dkf2iawWxyqnzVlM1uaMHI9EkK6d2D9MSN4YXr6xoHDGqo1KM72hmT4+rdddD103lGnXhMITpQtlN4EiIzFZlZtAvpALBoO+RJa3lZG67v/NLWOY5O/0xuXjNyfMhIe1ulyyjJxrxtIY2cTNjEJErVVfC1p6pePQSD+BAP438jHM7IL8QkQD5fKWXd7rjWCQ6a6JakLvE7fPuzD7fSXVa6SEgtA8Vp2RcBxLBlLonI/vkBwcBl+ijmXyeCahB3TSGPQCRuhoXUqscsCKq+H8fFs6h2xdbEu7LsjLR1tLQFY9COPwuMZEXT9p/tfZBSmWa90EOXes9QEtbmIwGg6woh3Dh4JTzmudUfao/CEJXhAN6YemIEzXiSRbznuBq41aBR7RPv5CG9S+mi4S/+axlO+3IOO9MLsL9BkwXJOCrPvB9up3G5ZrPz68/JQ== X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:DM4PR12MB6280.namprd12.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230031)(39860400002)(376002)(136003)(396003)(366004)(346002)(230922051799003)(64100799003)(186009)(451199024)(1800799009)(66556008)(478600001)(66946007)(316002)(66476007)(8936002)(8676002)(4326008)(45080400002)(6486002)(31686004)(5660300002)(53546011)(6506007)(38100700002)(31696002)(86362001)(6512007)(41300700001)(2906002)(26005)(44832011)(2616005)(36756003)(45980500001)(43740500002);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?utf-8?B?TU91UEt5TWpucHB3YWpiMmorUWtTLy9jeVZZdFpXdlBHT3U5d2J5akdzSEd5?= =?utf-8?B?dDZZcDMrUTFDTkNFNXZ2bFFjeVgxL1Vmcmc2VTB2Ujd4aTlkVFVEbkNkTGkr?= =?utf-8?B?Sk1mUm93YW9pYWViTDFZdjhCaTkzVXZRTy8zYTlaUisyNW9xMG9teHBBeVRB?= =?utf-8?B?bUdHdTdZTmtqY0xHa3JRUFFiRU9oQmNIR05qcTIzZ1hMWkdlSVovNkJkMFd0?= =?utf-8?B?VGxlbXJBZUNXM002amE4Q3Y1Qm0rS2tpK21OVC9vSGFxbVF3Mm5MZVl1NHdh?= =?utf-8?B?NklVOWVNSmF1WHhrNkc5bVR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SB5mqJ9Zp2bjys5SJCATnHRQJ?= X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-Network-Message-Id: 2b6797af-c04e-4c09-6af5-08dbd704ebc0 X-MS-Exchange-CrossTenant-AuthSource: DM4PR12MB6280.namprd12.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 27 Oct 2023 15:53:53.9109 (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: hfQ76IlKzQN9b4SJXPlx+V2gR9lzmn8dT6+S+EehqrMXmAkO4sPaHUBykzpDDNgnKqdcU33Sc+/BczaY35WdEQ== X-MS-Exchange-Transport-CrossTenantHeadersStamped: DM4PR12MB7528 X-Spam-Status: No, score=-0.8 required=5.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on pete.vger.email Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (pete.vger.email [0.0.0.0]); Fri, 27 Oct 2023 08:54:11 -0700 (PDT) Also, please write the tagline in present tense. On 10/27/23 11:53, Hamza Mahfooz wrote: > On 10/26/23 17:25, Yuran Pereira wrote: >> Since `pr_config` is not initialized after its declaration, the >> following operations with `replay_enable_option` may be performed >> when `replay_enable_option` is holding junk values which could >> possibly lead to undefined behaviour >> >> ``` >>      ... >>      pr_config.replay_enable_option |= pr_enable_option_static_screen; >>      ... >> >>      if (!pr_config.replay_timing_sync_supported) >>          pr_config.replay_enable_option &= ~pr_enable_option_general_ui; >>      ... >> ``` >> >> This patch initializes `pr_config` after its declaration to ensure that >> it doesn't contain junk data, and prevent any undefined behaviour >> >> Addresses-Coverity-ID: 1544428 ("Uninitialized scalar variable") >> Fixes: dede1fea4460 ("drm/amd/display: Add Freesync Panel DM code") >> Signed-off-by: Yuran Pereira >> --- >>   drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_replay.c | 3 +++ >>   1 file changed, 3 insertions(+) >> >> diff --git a/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_replay.c >> b/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_replay.c >> index 32d3086c4cb7..40526507f50b 100644 >> --- a/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_replay.c >> +++ b/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_replay.c >> @@ -23,6 +23,7 @@ >>    * >>    */ >> +#include >>   #include "amdgpu_dm_replay.h" >>   #include "dc.h" >>   #include "dm_helpers.h" >> @@ -74,6 +75,8 @@ bool amdgpu_dm_setup_replay(struct dc_link *link, >> struct amdgpu_dm_connector *ac >>       struct replay_config pr_config; > > I would prefer setting pr_config = {0}; > >>       union replay_debug_flags *debug_flags = NULL; >> +    memset(&pr_config, 0, sizeof(pr_config)); >> + >>       // For eDP, if Replay is supported, return true to skip checks >>       if (link->replay_settings.config.replay_supported) >>           return true; -- Hamza