From nobody Mon Nov 25 04:53:50 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; arc=pass (i=1 dmarc=pass fromdomain=amd.com); dmarc=pass(p=quarantine dis=none) header.from=amd.com ARC-Seal: i=2; a=rsa-sha256; t=1717805360; cv=pass; d=zohomail.com; s=zohoarc; b=Lq0FCuGgLlIclNy1nRrB9XjPKuNAs4abD4sOoEqiIjpdVEGTlZVR97ED1uPLEimv/HgWoyDtfFW1uvEiMXbHfw5mbYyPIf/gZCXsOnTCdmnONO7wjhsGYs16jbdhyQ2DqBf2e76foD3WDiF9XgGyoj/QXgvMD+FpGcdUlC7zo58= ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1717805360; h=Content-Type:Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=KDsdZeowbmmZGJ+3oiV9FAHm4JaiKldSCBUVp8zibR8=; b=kowTUkmnlDzPqPO8JtTjIm3VZikPDTjrHBzPRXeVVHAkGQe9YxMOJBE2gfIz0PFr1MGBxK1qEUoDfAD8J9sgYn8kV3Rw2MS7cOdtb98I/ZiAsW+O8oI4Xsp+SjAa1h3BNQulgtF+XBUIImSxVi3gmgmeYAhtOoaAQdXPa7m2bgs= ARC-Authentication-Results: i=2; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; arc=pass (i=1 dmarc=pass fromdomain=amd.com); dmarc=pass header.from= (p=quarantine dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1717805360877513.4354704570763; Fri, 7 Jun 2024 17:09:20 -0700 (PDT) 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 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 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 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= 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 (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; 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 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 Content-Transfer-Encoding: quoted-printable 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: =?us-ascii?Q?w8gAQwL0cz5HbBeE49LRKx2uzgcsQ8ne4J6giBoLdek16/f1ny5XoyF0kZNA?= =?us-ascii?Q?dNr40wvi/WWidUnq8EXVOITXk5PW94iGnha3Kkc0RSeAB35ESJ7OO2CLIoND?= =?us-ascii?Q?wtGQA8QA02Jbd1yK0z74eHXQ5OVDgi/5mEB95sK+jUzmgjZs3dczIplK/aKe?= =?us-ascii?Q?LKUyu4WdkzTJZXR6lyLsBn3HRd4dLW55J/pCuxA0oYZzL8kMLqYmks5vQ4fS?= =?us-ascii?Q?VDHG/CDPK5B72AB6SE+q769y+4nc82FaT8Ohq7/xbtZo9T6SNzMncMeeOwHH?= =?us-ascii?Q?OxPIEZuWQYp1sb2SAZ/siEN6qiDzYR8XlZFWURF6axW0J7FBS/WSw03aBMeX?= =?us-ascii?Q?LVARTE6haldGtQwuJ887TmBL39h/yZtfHP2gBpQcEK1bTCJX4fIhjn2kJXzd?= =?us-ascii?Q?uZef0MMHcQsFYM+q7jXM1lvwSAtVfDQiSSItK1hwhkctpnqp01GHIuBufXzq?= =?us-ascii?Q?UtWo3sGQdJmiiIePg4cQJP30e183/M3BRIHKfayQBBbARIlDGB7PDrq4CpH+?= =?us-ascii?Q?DdRB1uj4qZj+LLGt1w/YmR5HsMvsZ4sLuaiRHnFCLpXI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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+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @amd.com) X-ZM-MESSAGEID: 1717805362691100003 Content-Type: text/plain; charset="utf-8" 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 =3D SEV_COMMON(MACHINE(qdev_get_machine())-= >cgs); - SevCommonStateClass *klass =3D SEV_COMMON_GET_CLASS(sev_common); + SevCommonStateClass *klass; =20 if (!sev_common) { return 0; } + klass =3D SEV_COMMON_GET_CLASS(sev_common); =20 /* if SEV is in update state then encrypt the data else do nothing */ if (sev_check_state(sev_common, SEV_STATE_LAUNCH_UPDATE)) { --=20 2.34.1