From nobody Mon Mar 2 10:53:01 2026 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; 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; dmarc=pass(p=none dis=none) header.from=nongnu.org ARC-Seal: i=1; a=rsa-sha256; t=1772231571; cv=none; d=zohomail.com; s=zohoarc; b=JheT/uX8hzfxCPOu608Ad5oPUG4VtekigG5Z36TUtxg9b6F+YL2iaCFSEvi7HVY0LUtjtsfNxb2PKUXPwRvAjqXDIUBAQsrMNcXPeFe3xVsUisOIqdYJ9AsfGSS0jVB/CIQ1dag6Mjczwo50wlNzA3j66KDJar2ssmsglkshA/8= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1772231571; 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:Reply-To:Reply-To:References:Sender:Subject:Subject:To:To:Message-Id; bh=YPfzPK2MywvQCkbvEaAz+6WewPPqN/E2mWOoscd682w=; b=GoloWnbNtVk4A4nNxNSetM8/PwKVw0PB6T5bIYm3wMZZ0okOtR/yYvUnMss3j2guOhMRc92uTiO/S9rRqHSKbaRfGD58MIaZPx3cVmEnvXGq1DL+UUHOM9mQm68eTJ2Gyhw1X9ukmm2gut5GXJfns8Abeso9HoOr4FC7OD6gGEU= ARC-Authentication-Results: i=1; mx.zohomail.com; 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; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1772231571330370.95589830234985; Fri, 27 Feb 2026 14:32:51 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1vw6Nh-0004BM-AY; Fri, 27 Feb 2026 17:32:21 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1vw6Nf-0004AV-NT for qemu-devel@nongnu.org; Fri, 27 Feb 2026 17:32:19 -0500 Received: from frasgout.his.huawei.com ([185.176.79.56]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1vw6Nd-0001k2-SH for qemu-devel@nongnu.org; Fri, 27 Feb 2026 17:32:19 -0500 Received: from mail.maildlp.com (unknown [172.18.224.83]) by frasgout.his.huawei.com (SkyGuard) with ESMTPS id 4fN32X329NzHnGch; Sat, 28 Feb 2026 06:31:16 +0800 (CST) Received: from dubpeml500008.china.huawei.com (unknown [7.214.146.94]) by mail.maildlp.com (Postfix) with ESMTPS id 1962240569; Sat, 28 Feb 2026 06:32:03 +0800 (CST) Received: from P_UKIT01-A7bmah.china.huawei.com (10.126.175.34) by dubpeml500008.china.huawei.com (7.214.146.94) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.1544.11; Fri, 27 Feb 2026 22:32:02 +0000 To: , , , , , CC: , Subject: [PATCH 1/3] hw/cxl: Add fixes in maintenance and memory sparing Date: Fri, 27 Feb 2026 22:32:04 +0000 Message-ID: <20260227223207.972-2-shiju.jose@huawei.com> X-Mailer: git-send-email 2.43.0.windows.1 In-Reply-To: <20260227223207.972-1-shiju.jose@huawei.com> References: <20260227223207.972-1-shiju.jose@huawei.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Originating-IP: [10.126.175.34] X-ClientProxiedBy: lhrpeml100012.china.huawei.com (7.191.174.184) To dubpeml500008.china.huawei.com (7.214.146.94) 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 client-ip=185.176.79.56; envelope-from=shiju.jose@huawei.com; helo=frasgout.his.huawei.com X-Spam_score_int: -30 X-Spam_score: -3.1 X-Spam_bar: --- X-Spam_report: (-3.1 / 5.0 requ) BAYES_00=-1.9, RCVD_IN_DNSWL_MED=-2.3, RCVD_IN_MSPIKE_H4=0.001, RCVD_IN_MSPIKE_WL=0.001, RCVD_IN_VALIDITY_CERTIFIED_BLOCKED=0.706, RCVD_IN_VALIDITY_RPBL_BLOCKED=0.401, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 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: qemu development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Reply-to: From: shiju.jose--- via qemu development Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZM-MESSAGEID: 1772231572901158500 Content-Type: text/plain; charset="utf-8" From: Shiju Jose Add following fixes to the commit: hw/cxl: Add support for Maintenance command and Post Package Repair (PPR). 1. In cxl_create_mem_sparing_event_records(), replace strncpy with memcpy to solve coverity warning because full size of the array to use as length in strncpy to copy the entire component id data, which is 16 bytes. 2. In cxl_maintenance_insert(), - replace strncpy with memcpy in to copy full data because component id is 16 bytes data. - remove memset which is not required. Reported-by: Peter Maydell Signed-off-by: Shiju Jose --- hw/cxl/cxl-mailbox-utils.c | 4 ++-- hw/mem/cxl_type3.c | 4 +--- 2 files changed, 3 insertions(+), 5 deletions(-) diff --git a/hw/cxl/cxl-mailbox-utils.c b/hw/cxl/cxl-mailbox-utils.c index c83b5f90d4..9c99422cd4 100644 --- a/hw/cxl/cxl-mailbox-utils.c +++ b/hw/cxl/cxl-mailbox-utils.c @@ -1994,8 +1994,8 @@ static void cxl_create_mem_sparing_event_records(CXLT= ype3Dev *ct3d, stw_le_p(&event_rec.column, ent->column); event_rec.sub_channel =3D ent->sub_channel; if (ent->validity_flags & CXL_MSER_VALID_COMP_ID) { - strncpy((char *)event_rec.component_id, (char *)ent->component= _id, - sizeof(event_rec.component_id)); + memcpy(event_rec.component_id, ent->component_id, + sizeof(event_rec.component_id)); } } else if (sparing_pi) { event_rec.flags =3D CXL_MSER_FLAGS_QUERY_RESOURCES; diff --git a/hw/mem/cxl_type3.c b/hw/mem/cxl_type3.c index 4739239da3..3cb1096e16 100644 --- a/hw/mem/cxl_type3.c +++ b/hw/mem/cxl_type3.c @@ -1767,7 +1767,6 @@ static void cxl_maintenance_insert(CXLType3Dev *ct3d,= uint64_t dpa, } } m =3D g_new0(CXLMaintenance, 1); - memset(m, 0, sizeof(*m)); m->dpa =3D dpa; m->validity_flags =3D 0; =20 @@ -1804,8 +1803,7 @@ static void cxl_maintenance_insert(CXLType3Dev *ct3d,= uint64_t dpa, m->validity_flags |=3D CXL_MSER_VALID_SUB_CHANNEL; } if (component_id) { - strncpy((char *)m->component_id, component_id, - sizeof(m->component_id) - 1); + memcpy(m->component_id, component_id, sizeof(m->component_id)); m->validity_flags |=3D CXL_MSER_VALID_COMP_ID; if (has_comp_id_pldm && is_comp_id_pldm) { m->validity_flags |=3D CXL_MSER_VALID_COMP_ID_FORMAT; --=20 2.43.0