From patchwork Fri Jun 7 18:36:09 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Gupta, Pankaj" X-Patchwork-Id: 1945353 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=amd.com header.i=@amd.com header.a=rsa-sha256 header.s=selector1 header.b=lj5gWGCi; dkim-atps=neutral Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=nongnu.org (client-ip=209.51.188.17; helo=lists.gnu.org; envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org; receiver=patchwork.ozlabs.org) Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-ECDSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4Vwygc69Ptz20Py for ; Sat, 8 Jun 2024 09:53:00 +1000 (AEST) Received: from [::1] (helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1sFeWj-0001J2-0K; Fri, 07 Jun 2024 14:41:25 -0400 Received: from [2001:470:142:3::10] (helo=eggs.gnu.org) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1sFeWh-0001Ie-Sd for qemu-devel@nongnu.org; Fri, 07 Jun 2024 14:41:23 -0400 Received: from mail-bn8nam12on2066.outbound.protection.outlook.com ([40.107.237.66] helo=NAM12-BN8-obe.outbound.protection.outlook.com) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1sFeWf-0004zG-PF for qemu-devel@nongnu.org; Fri, 07 Jun 2024 14:41:23 -0400 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=VX5VAaqcKcPMPA79ONTSElfz9rBcW9HRTb9zGPAXvKav3m5Yzta4QRhBxxA8iASr/Ibt8w0z4GXxtza7Ji9kKaSzUDkwuA/6NuR/vcQp3zQpEjLkDqa4KZpUeIUe8tjc+SxxUhCwzNVibMnHOcepKiDsKUru1x47AmJjSf0dOzRXbASFUjsmZqj/IML1qFi3w8B68p/bqrwMtFbgQX53PPCiYhQ+PHyzAjAwHxP8k+L966sInGaYRId9EcOWW6t15qZ3G3vLWAYrb8W3cqmoVWgKpCtoHMhpXytDgBcxxIomFaCMPunNlMSzYGVkApYJNZE1w6RcL7hdSHNpg52fOQ== 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=SoEPsBZrntgvpqMHJQA3K4x/Je9bBwc5EHsPTJpCPLU=; b=JPdxGwRPuBN9blwZCcc6mysLLQzq5TkVLdhJJMGutJKXo2WBOP2IN8Xg0duoHbwESuRdbIjjqlgShEvihjgcKz8VzfcrfCcEzOYfy7Oxof4KwgA2drD8sFw99Vz41Ff8TTU7ZMOHthJloYGDAev+LT+I7R/sKIELJpj5045kiPa/HHu2djJOVAWhXs6OXMn3xuYwb0cpdsBw+eHI3ptkYgZew1rZUU0tZBp5oHC3ZoMabnXx5PXqwjt5FLSEWNAn0eIVcpn/ZFhYhEiNKILztDGrNyId+r3zQ9BtQC1E1TFlikaE+dtMxcjyxGaflA3sJVFIQZCi3SsXtouk13NcGQ== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 165.204.84.17) smtp.rcpttodomain=nongnu.org smtp.mailfrom=amd.com; dmarc=pass (p=quarantine sp=quarantine pct=100) action=none header.from=amd.com; dkim=none (message not signed); arc=none (0) 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=SoEPsBZrntgvpqMHJQA3K4x/Je9bBwc5EHsPTJpCPLU=; b=lj5gWGCiKSQIomBX08yDeWGpNAPvmRq4Ded5FU8Y7UwdwIVARIf4+H3VLVHjtonC8Z0OUOvz/cwSnsYj304JbZyC9xmF+U7BIhEnEGqwp//ldSxXlYPC1247lYW5D75NDHc4jjkLCO6fvouX29MXC6X4B+JOBsKQ0kvXc363eCo= Received: from MW2PR2101CA0017.namprd21.prod.outlook.com (2603:10b6:302:1::30) by DM6PR12MB4123.namprd12.prod.outlook.com (2603:10b6:5:21f::23) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7633.35; Fri, 7 Jun 2024 18:36:15 +0000 Received: from CO1PEPF000044F6.namprd21.prod.outlook.com (2603:10b6:302:1:cafe::ca) by MW2PR2101CA0017.outlook.office365.com (2603:10b6:302:1::30) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7677.12 via Frontend Transport; Fri, 7 Jun 2024 18:36:13 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 165.204.84.17) smtp.mailfrom=amd.com; dkim=none (message not signed) header.d=none;dmarc=pass action=none header.from=amd.com; Received-SPF: Pass (protection.outlook.com: domain of amd.com designates 165.204.84.17 as permitted sender) receiver=protection.outlook.com; client-ip=165.204.84.17; helo=SATLEXMB04.amd.com; pr=C Received: from SATLEXMB04.amd.com (165.204.84.17) by CO1PEPF000044F6.mail.protection.outlook.com (10.167.241.196) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.7677.0 via Frontend Transport; Fri, 7 Jun 2024 18:36:14 +0000 Received: from SATLEXMB04.amd.com (10.181.40.145) by SATLEXMB04.amd.com (10.181.40.145) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.35; Fri, 7 Jun 2024 13:36:12 -0500 Received: from pankaj-M75q.amd.com (10.180.168.240) by SATLEXMB04.amd.com (10.181.40.145) with Microsoft SMTP Server id 15.1.2507.35 via Frontend Transport; Fri, 7 Jun 2024 13:36:11 -0500 From: Pankaj Gupta To: CC: , , , , , , , Subject: [PATCH 1/3] i386/sev: fix unreachable code coverity issue Date: Fri, 7 Jun 2024 13:36:09 -0500 Message-ID: <20240607183611.1111100-2-pankaj.gupta@amd.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240607183611.1111100-1-pankaj.gupta@amd.com> References: <20240607183611.1111100-1-pankaj.gupta@amd.com> MIME-Version: 1.0 Received-SPF: None (SATLEXMB04.amd.com: pankaj.gupta@amd.com does not designate permitted sender hosts) X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: CO1PEPF000044F6:EE_|DM6PR12MB4123:EE_ X-MS-Office365-Filtering-Correlation-Id: b5644ca6-83a6-4a29-95cd-08dc8720b635 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; ARA:13230031|1800799015|36860700004|376005|82310400017; X-Microsoft-Antispam-Message-Info: LW3cu4MJXFR9ZtyKO0rtkynD/KE8kL5dKEh+mcZvjxZsGAyCuRRT+JGjNA30ujDsf0VF1BvmTrHdoE6MX37c4z6iQYNUAjfwqSTVkqP7wOWzGTnoqdyU8zYLkupJCE9znQJfkeg7jUw3wy9XcWTFa+JfGw/t+fx+nQ4UJm/0pzKl50NZEm6gCiZmMlPPnVj6DFmHwu6XNaULZrdix7DagDc/+CArzecMheE8T6xfeVOs/5JYtRUhF2GteiViCdbU0g+KTRW1cWgX8tjerRxvef4ja++BIl0JB4iVahgE6yRYr3+Odrf1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khm8krWwgq36FDryN136W17zf6+RYU7i4P8NA== X-Forefront-Antispam-Report: CIP:165.204.84.17; CTRY:US; LANG:en; SCL:1; SRV:; IPV:CAL; SFV:NSPM; H:SATLEXMB04.amd.com; PTR:InfoDomainNonexistent; CAT:NONE; SFS:(13230031)(1800799015)(36860700004)(376005)(82310400017); DIR:OUT; SFP:1101; X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 07 Jun 2024 18:36:14.3248 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: b5644ca6-83a6-4a29-95cd-08dc8720b635 X-MS-Exchange-CrossTenant-Id: 3dd8961f-e488-4e60-8e11-a82d994e183d X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=3dd8961f-e488-4e60-8e11-a82d994e183d; Ip=[165.204.84.17]; Helo=[SATLEXMB04.amd.com] X-MS-Exchange-CrossTenant-AuthSource: CO1PEPF000044F6.namprd21.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: DM6PR12MB4123 Received-SPF: permerror client-ip=40.107.237.66; envelope-from=Pankaj.Gupta@amd.com; helo=NAM12-BN8-obe.outbound.protection.outlook.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.001, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_MSPIKE_H2=-0.001, SPF_HELO_PASS=-0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Set 'finish->id_block_en' when block_size read. coverity #1546887 fixes: 7b34df4426 ("i386/sev: Introduce 'sev-snp-guest' object") Signed-off-by: Pankaj Gupta --- target/i386/sev.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/target/i386/sev.c b/target/i386/sev.c index 004c667ac1..7c9df621de 100644 --- a/target/i386/sev.c +++ b/target/i386/sev.c @@ -2165,6 +2165,7 @@ sev_snp_guest_set_id_block(Object *obj, const char *value, Error **errp) struct kvm_sev_snp_launch_finish *finish = &sev_snp_guest->kvm_finish_conf; gsize len; + finish->id_block_en = 0; g_free(sev_snp_guest->id_block); g_free((guchar *)finish->id_block_uaddr); @@ -2184,7 +2185,7 @@ sev_snp_guest_set_id_block(Object *obj, const char *value, Error **errp) return; } - finish->id_block_en = (len) ? 1 : 0; + finish->id_block_en = 1; } static char * From patchwork Fri Jun 7 18:36:10 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Gupta, Pankaj" X-Patchwork-Id: 1945370 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=amd.com header.i=@amd.com header.a=rsa-sha256 header.s=selector1 header.b=5km+XCj8; dkim-atps=neutral Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=nongnu.org (client-ip=209.51.188.17; helo=lists.gnu.org; envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org; receiver=patchwork.ozlabs.org) Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-ECDSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4Vwz2T5jX3z20Py for ; Sat, 8 Jun 2024 10:09:21 +1000 (AEST) Received: from [::1] (helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1sFeRv-0000uH-FK; Fri, 07 Jun 2024 14:36:27 -0400 Received: from [2001:470:142:3::10] (helo=eggs.gnu.org) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1sFeRt-0000u4-PQ for qemu-devel@nongnu.org; Fri, 07 Jun 2024 14:36:25 -0400 Received: from mail-bn8nam11on20626.outbound.protection.outlook.com ([2a01:111:f403:2414::626] helo=NAM11-BN8-obe.outbound.protection.outlook.com) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1sFeRr-0003rl-5t for qemu-devel@nongnu.org; Fri, 07 Jun 2024 14:36:25 -0400 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=iTaEiSkTCpyI8a7qJL8Kc9xC63Cw+L4nuJ4holWZ3TWoVqj6IJdfptNd6zuyirVo2dn8feZjtSQxXTMYcT4HoLTbzOfM948YG+ZD3OqzJE5fsybyQchcyZ462sdqKqd4WG7yB+BzCFbaMYuHZj/kwqWyXQcDvxcl6UAm++HtxPuca4kzY6VrhODdlAqhyL22M1ME4YdhymTYTstc+wawlYVySplVu4wsYa9M921+cWzbeWnjFMEopMTlW7897fRGx7MTcIkNTWBcNUpZmqhS5mx4BNuDke2nQWJVstTE1cSeYScdp5fpiRiEeDp4G1mM8l0XbY7gZ20hxcZkjupJzA== 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=KDsdZeowbmmZGJ+3oiV9FAHm4JaiKldSCBUVp8zibR8=; b=TvVrnv8jCNBfgIGyxYzMLWjNEQxQyeTFBGNvd5N5bTw76sDMs3fhYWL/PmYvgauSNBhCWKugz7+wU3A8xTuu4P6MfAR/YQojM9kqqCO8qkQuT+jPjqqII2dJdKca87lavX3batwgyIJYbln7wNoTWBOylEmnXZRGWbgPwMmfbXddSu9D4T56pm9dvyQF18+CHf83+H5TZcIKYEE1gTJM+kfGD2hITr1BTN1eQMQQrILeeFvZIn1H3M4L4cCT2TUbnkQkznQJgCCzMKWPSGFcUVqlnbclZO2Yu0kuCGLzfqZ0q//RND5Ua3oj1DZ8VkxP+Z0tIsWTE7Gf6SR/6fAfcg== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 165.204.84.17) smtp.rcpttodomain=nongnu.org smtp.mailfrom=amd.com; dmarc=pass (p=quarantine sp=quarantine pct=100) action=none header.from=amd.com; dkim=none (message not signed); arc=none (0) 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=KDsdZeowbmmZGJ+3oiV9FAHm4JaiKldSCBUVp8zibR8=; b=5km+XCj8StmMT2AD90IeQ6EmZ1UpUPnPvdCrvoWMnra/O/QHP3TWTMdUlzrfIS/LHEoJ8YZQpBYa24vgMSlYFKiGu4I2c47FL2ESuSPpWlkvPDSaAtDK4j2QylMlPBEcu1vJoOX695ZbfjwrfnWiPt20BrePlV0pFyejozlP8XA= Received: from MW2PR2101CA0036.namprd21.prod.outlook.com (2603:10b6:302:1::49) by PH7PR12MB6833.namprd12.prod.outlook.com (2603:10b6:510:1af::12) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7633.34; Fri, 7 Jun 2024 18:36:16 +0000 Received: from CO1PEPF000044F6.namprd21.prod.outlook.com (2603:10b6:302:1:cafe::a) by MW2PR2101CA0036.outlook.office365.com (2603:10b6:302:1::49) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7677.9 via Frontend Transport; Fri, 7 Jun 2024 18:36:16 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 165.204.84.17) smtp.mailfrom=amd.com; dkim=none (message not signed) header.d=none;dmarc=pass action=none header.from=amd.com; Received-SPF: Pass (protection.outlook.com: domain of amd.com designates 165.204.84.17 as permitted sender) receiver=protection.outlook.com; client-ip=165.204.84.17; helo=SATLEXMB04.amd.com; pr=C Received: from SATLEXMB04.amd.com (165.204.84.17) by CO1PEPF000044F6.mail.protection.outlook.com (10.167.241.196) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.7677.0 via Frontend Transport; Fri, 7 Jun 2024 18:36:16 +0000 Received: from SATLEXMB04.amd.com (10.181.40.145) by SATLEXMB04.amd.com (10.181.40.145) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.35; Fri, 7 Jun 2024 13:36:12 -0500 Received: from pankaj-M75q.amd.com (10.180.168.240) by SATLEXMB04.amd.com (10.181.40.145) with Microsoft SMTP Server id 15.1.2507.35 via Frontend Transport; Fri, 7 Jun 2024 13:36:12 -0500 From: Pankaj Gupta To: CC: , , , , , , , Subject: [PATCH 2/3] i386/sev: Move SEV_COMMON null check before dereferencing Date: Fri, 7 Jun 2024 13:36:10 -0500 Message-ID: <20240607183611.1111100-3-pankaj.gupta@amd.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240607183611.1111100-1-pankaj.gupta@amd.com> References: <20240607183611.1111100-1-pankaj.gupta@amd.com> MIME-Version: 1.0 Received-SPF: None (SATLEXMB04.amd.com: pankaj.gupta@amd.com does not designate permitted sender hosts) X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: CO1PEPF000044F6:EE_|PH7PR12MB6833:EE_ X-MS-Office365-Filtering-Correlation-Id: 103586f7-77fe-40a2-004c-08dc8720b743 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; ARA:13230031|82310400017|36860700004|376005|1800799015; X-Microsoft-Antispam-Message-Info: w8gAQwL0cz5HbBeE49LRKx2uzgcsQ8ne4J6giBoLdek16/f1ny5XoyF0kZNAdNr40wvi/WWidUnq8EXVOITXk5PW94iGnha3Kkc0RSeAB35ESJ7OO2CLIoNDwtGQA8QA02Jbd1yK0z74eHXQ5OVDgi/5mEB95sK+jUzmgjZs3dczIplK/aKeLKUyu4WdkzTJZXR6lyLsBn3HRd4dLW55J/pCuxA0oYZzL8kMLqYmks5vQ4fSVDHG/CDPK5B72AB6SE+q769y+4nc82FaT8Ohq7/xbtZo9T6SNzMncMeeOwHHOxPIEZuWQYp1sb2SAZ/siEN6qiDzYR8XlZFWURF6axW0J7FBS/WSw03aBMeXLVARTE6haldGtQwuJ887TmBL39h/yZtfHP2gBpQcEK1bTCJX4fIhjn2kJXzduZef0MMHcQsFYM+q7jXM1lvwSAtVfDQiSSItK1hwhkctpnqp01GHIuBufXzqUtWo3sGQdJmiiIePg4cQJP30e183/M3BRIHKfayQBBbARIlDGB7PDrq4CpH+DdRB1uj4qZj+LLGt1w/YmR5HsMvsZ4sLuaiRHnFCLpXIw+bWWx+yjZ9d78cPL6n9Zd9F/aQqnAKOhp9MwUhcn2cpUiOck3IHnhYZnTIgHkpqt3T/CJ421mNXWv93mSWn6DiTFv5WFgI0ApQjEDhcQP025pST4TnlWy73qrqNxQJA93WrrCRS/8FBSVYDcjnLvh3R7CDt8jV6FaW5Gu8VA9YPyzYgJrHejQ/bpXuCHZm17LR9m3Ls3Tly1sGK+1sYvSB/JdpvyuHtJBcj9E8A86EyK+UkCEc9z71Hwwg5La17Gwd42jjk3B6Vx5SlNCEFCTkK3kDcUQYvOrWVL/ci6cq7uaGEPq6bGDAub3K1ZA+2hJLQU2tvnTx+edhVC6gaK8A+RghcTgifU0lAlGUsVMx6qwd46NiJrbu0xnHJE4UHP1uYmZ1AVi6x3jdcAG5f+SEwg2ECBppnIs0cS2fWQie11VKWSn66FojxVQUkb14yuv8DBKw1YwlidQih/AXJVrNFCmcAeuktjddcDcAjOaQwe+SDISFkvc9hRFt+06bL5cSuQzR6S9Wqtt2e26lf9G2jfEGsb2j0JvJuzbkZKwyyf0peSu8PZwwMpr3E5yUz70koecMU/4JhT4t1dhnXXwq2EICtLB7rSCvXLzKzDCtMTg7f9ueF3J0pre8kCYZgVMN7fo0kAZKFKDccCAdgz3KPzcX2SFjc18XRy5vKX/tu4Ko9/zS0cJyK8E9DiRngYLbPlDgz2oUzOBWtc4JdZXVm9iuBoTNbrdb76SzoqoS/FG7YYBaKS2ZjhHrBzr+UTK7zHtTVu2Qru++poyMDBE9jm0JtEF3d5zPI17sCv7+fliRc70EFN5L8jN0Bfo3l2okiysuDGF/R5Q== X-Forefront-Antispam-Report: CIP:165.204.84.17; CTRY:US; LANG:en; SCL:1; SRV:; IPV:CAL; SFV:NSPM; H:SATLEXMB04.amd.com; PTR:InfoDomainNonexistent; CAT:NONE; SFS:(13230031)(82310400017)(36860700004)(376005)(1800799015); DIR:OUT; SFP:1101; X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 07 Jun 2024 18:36:16.1530 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 103586f7-77fe-40a2-004c-08dc8720b743 X-MS-Exchange-CrossTenant-Id: 3dd8961f-e488-4e60-8e11-a82d994e183d X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=3dd8961f-e488-4e60-8e11-a82d994e183d; Ip=[165.204.84.17]; Helo=[SATLEXMB04.amd.com] X-MS-Exchange-CrossTenant-AuthSource: CO1PEPF000044F6.namprd21.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: PH7PR12MB6833 Received-SPF: permerror client-ip=2a01:111:f403:2414::626; envelope-from=Pankaj.Gupta@amd.com; helo=NAM11-BN8-obe.outbound.protection.outlook.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.001, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, SPF_HELO_PASS=-0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org coverity #1546886 fixes: 9861405a8f ("i386/sev: Invoke launch_updata_data() for SEV class") Signed-off-by: Pankaj Gupta --- target/i386/sev.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/target/i386/sev.c b/target/i386/sev.c index 7c9df621de..f18432f58e 100644 --- a/target/i386/sev.c +++ b/target/i386/sev.c @@ -1529,11 +1529,12 @@ int sev_encrypt_flash(hwaddr gpa, uint8_t *ptr, uint64_t len, Error **errp) { SevCommonState *sev_common = SEV_COMMON(MACHINE(qdev_get_machine())->cgs); - SevCommonStateClass *klass = SEV_COMMON_GET_CLASS(sev_common); + SevCommonStateClass *klass; if (!sev_common) { return 0; } + klass = SEV_COMMON_GET_CLASS(sev_common); /* if SEV is in update state then encrypt the data else do nothing */ if (sev_check_state(sev_common, SEV_STATE_LAUNCH_UPDATE)) { From patchwork Fri Jun 7 18:36:11 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Gupta, Pankaj" X-Patchwork-Id: 1945352 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=amd.com header.i=@amd.com header.a=rsa-sha256 header.s=selector1 header.b=MQfprpVe; dkim-atps=neutral Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=nongnu.org (client-ip=209.51.188.17; helo=lists.gnu.org; envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org; receiver=patchwork.ozlabs.org) Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-ECDSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4VwyfT0qQFz20Py for ; Sat, 8 Jun 2024 09:52:01 +1000 (AEST) Received: from [::1] (helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1sFeWj-0001JZ-Hn; Fri, 07 Jun 2024 14:41:25 -0400 Received: from [2001:470:142:3::10] (helo=eggs.gnu.org) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1sFeWi-0001It-98 for qemu-devel@nongnu.org; Fri, 07 Jun 2024 14:41:24 -0400 Received: from mail-bn8nam12on2080.outbound.protection.outlook.com ([40.107.237.80] helo=NAM12-BN8-obe.outbound.protection.outlook.com) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1sFeWg-0004zZ-Jq for qemu-devel@nongnu.org; Fri, 07 Jun 2024 14:41:24 -0400 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=PCVnwW2Z91GLQSc0i5IXdgUigj4rUx1NCX+X/287F4MN0mJupRWFsF5x975+hlMA7jhtFBazu6pXovwG6UL19gpyCUgwZi8z+ORm53JXl06X/ZrGbZR3vUZCHutdUCGC98zWinPoWnCbkdXFQndSDChPn7fk3RjEeI5re0UojcKBruNrj3W2Aat9eEYntihhm3lXGddAQwvEDdGK5oYMPIxu3eHOCKtcnZOnnEZefFkIWrq0vNDfP1R55bBXIAX9kiHMq5BeEvnHF3M68p+e+T7X2mU83z/WmY8sXh2v2rs4VqB8sMUn8kHWyStqKXB12iXXAVy4OJFgq48ApHJgHA== 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=I8F0oGA8VEPZYg934kR/lZOH1mCEaW9Eu2/EEHu3xmE=; b=cZMgzNpJnDy7Tq7kQsmJcF1XjtlHAySjF7R6lEArE75Z4RX0OTTfNraOy+z/8w8sW5O8iwcNJYCjcX2kQBO6ZZeV68lCL6PkT/lfddFwx933nWU93AEWKP9XKQchzl6z7UqhQlb6E7PmSCbO3aNWv/FFjdApc8Cb8oVryQp4s93q5hdc+DmVRPl9dysBrBvaxnzdbcIC5Z3UYTRfisnJ93cF7dxNDUuKmvI8gMcmgPfSFfYQKBgyrh+6QrgFDaJx7q96xlihTthZpNL3tOp2+j+Y/hrdZY6tehT7lM3yO1l5N6E+m3w0LcdcAghDTn8H6GXWBk4uGRdtHtxa7d1rOQ== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 165.204.84.17) smtp.rcpttodomain=nongnu.org smtp.mailfrom=amd.com; dmarc=pass (p=quarantine sp=quarantine pct=100) action=none header.from=amd.com; dkim=none (message not signed); arc=none (0) 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=I8F0oGA8VEPZYg934kR/lZOH1mCEaW9Eu2/EEHu3xmE=; b=MQfprpVeuiGEDIjGwqPXS4nHPj25xvTyRcPsCTZs1chK0RV1RRvftsHDn9OOGuJ7jdBJDQEgpSDeH6lnd9+DMliTf+34wPTfUvC2YUUoODBzanWUPpMqMwow1+FWJHm8porkee5WpsAJ5DlwXoO1u4GyS1bpcThMPZQk9TZJ0pE= Received: from MW2PR2101CA0003.namprd21.prod.outlook.com (2603:10b6:302:1::16) by SA3PR12MB9131.namprd12.prod.outlook.com (2603:10b6:806:395::15) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7633.34; Fri, 7 Jun 2024 18:36:17 +0000 Received: from CO1PEPF000044F6.namprd21.prod.outlook.com (2603:10b6:302:1:cafe::8d) by MW2PR2101CA0003.outlook.office365.com (2603:10b6:302:1::16) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7677.7 via Frontend Transport; Fri, 7 Jun 2024 18:36:13 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 165.204.84.17) smtp.mailfrom=amd.com; dkim=none (message not signed) header.d=none;dmarc=pass action=none header.from=amd.com; Received-SPF: Pass (protection.outlook.com: domain of amd.com designates 165.204.84.17 as permitted sender) receiver=protection.outlook.com; client-ip=165.204.84.17; helo=SATLEXMB04.amd.com; pr=C Received: from SATLEXMB04.amd.com (165.204.84.17) by CO1PEPF000044F6.mail.protection.outlook.com (10.167.241.196) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.7677.0 via Frontend Transport; Fri, 7 Jun 2024 18:36:17 +0000 Received: from SATLEXMB04.amd.com (10.181.40.145) by SATLEXMB04.amd.com (10.181.40.145) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.35; Fri, 7 Jun 2024 13:36:13 -0500 Received: from pankaj-M75q.amd.com (10.180.168.240) by SATLEXMB04.amd.com (10.181.40.145) with Microsoft SMTP Server id 15.1.2507.35 via Frontend Transport; Fri, 7 Jun 2024 13:36:12 -0500 From: Pankaj Gupta To: CC: , , , , , , , Subject: [PATCH 3/3] i386/sev: Return when sev_common is null Date: Fri, 7 Jun 2024 13:36:11 -0500 Message-ID: <20240607183611.1111100-4-pankaj.gupta@amd.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240607183611.1111100-1-pankaj.gupta@amd.com> References: <20240607183611.1111100-1-pankaj.gupta@amd.com> MIME-Version: 1.0 Received-SPF: None (SATLEXMB04.amd.com: pankaj.gupta@amd.com does not designate permitted sender hosts) X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: CO1PEPF000044F6:EE_|SA3PR12MB9131:EE_ X-MS-Office365-Filtering-Correlation-Id: fabf66d4-c2e6-4134-f99d-08dc8720b7dd X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; ARA:13230031|36860700004|1800799015|82310400017|376005; X-Microsoft-Antispam-Message-Info: JYxGin/nz8BHfusDsL/mgmbK/ufRgqf2skRKoESXwqyC/EpXClp2QxPpFnmKHrY1D/d6D0aChX90zLX1mf5H3QlAvF4/ijnCXpHVrh7ZCb8uMuXAmCg852LANLRO1dkuv0O66i4NUCe0pPFqKdP0lXM10diFWnBMbYADyWLG2/r3uqpd8+6/Cu/Nb02lpxEa2YPOH0IeEC3XOi6FPJ98r6QP2lpb4ebnvsI7p5qYUaJHQ8IcLg5EoTUjVgt9J/VQ4oQgHSvCfOS1CJNXgyX7GdcnivZk3pLnaYJd5D9x9EDX59lz8R5LqnTubrAGnjM1UaUgP5eY2BomLd6S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j/AJj42CxQN+te9laG9iOdw== X-Forefront-Antispam-Report: CIP:165.204.84.17; CTRY:US; LANG:en; SCL:1; SRV:; IPV:CAL; SFV:NSPM; H:SATLEXMB04.amd.com; PTR:InfoDomainNonexistent; CAT:NONE; SFS:(13230031)(36860700004)(1800799015)(82310400017)(376005); DIR:OUT; SFP:1101; X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 07 Jun 2024 18:36:17.1686 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: fabf66d4-c2e6-4134-f99d-08dc8720b7dd X-MS-Exchange-CrossTenant-Id: 3dd8961f-e488-4e60-8e11-a82d994e183d X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=3dd8961f-e488-4e60-8e11-a82d994e183d; Ip=[165.204.84.17]; Helo=[SATLEXMB04.amd.com] X-MS-Exchange-CrossTenant-AuthSource: CO1PEPF000044F6.namprd21.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: SA3PR12MB9131 Received-SPF: permerror client-ip=40.107.237.80; envelope-from=Pankaj.Gupta@amd.com; helo=NAM12-BN8-obe.outbound.protection.outlook.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.001, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_MSPIKE_H2=-0.001, SPF_HELO_PASS=-0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org coverity #1546885 fixes: 16dcf200dc ("i386/sev: Introduce "sev-common" type to encapsulate common SEV state") Signed-off-by: Pankaj Gupta --- target/i386/sev.c | 1 + 1 file changed, 1 insertion(+) diff --git a/target/i386/sev.c b/target/i386/sev.c index f18432f58e..c40562dce3 100644 --- a/target/i386/sev.c +++ b/target/i386/sev.c @@ -587,6 +587,7 @@ static SevCapability *sev_get_capabilities(Error **errp) sev_common = SEV_COMMON(MACHINE(qdev_get_machine())->cgs); if (!sev_common) { error_setg(errp, "SEV is not configured"); + return NULL; } sev_device = object_property_get_str(OBJECT(sev_common), "sev-device",