From nobody Mon Apr 13 12:34:26 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=1772792128; cv=none; d=zohomail.com; s=zohoarc; b=YYgqwBcSlOlyCcMtAPEjZu3/bkoUM/+JDE5LUQJjb77T3cLOD7JSYanS+IYaWd55HCOOIW7Yj2boctuwKgBMgYG3MF434JMMmpLboc7PS1YyfOAtcZBk8VlvwAUFzQMzK44ldiXwSciOag8dtxGjF6Zq0at48cj+bWAft61HnjY= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1772792128; 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=uPafPAxGW1+ZZ51WFgskCTS03WovQOteovCR7z96mgc=; b=XDASsSlDEzgfAezwmfh2KU4kOlgzEngae0OIjAD46c7Qu2ZK4FR4vO/PzkPX2HI8jgOihCZ5VreuawTys9DXSc/MOFS/SDrn8RRqTxilR+h5dc2zIf4GerzGzasMrSS3RU9Efj0AxtlT8T44/wH3+uiw+u99OZpK69cvM0BEgZI= 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 1772792128621292.609257975202; Fri, 6 Mar 2026 02:15:28 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1vySD4-0002Og-MO; Fri, 06 Mar 2026 05:15:06 -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 1vySCy-0002N7-SR for qemu-devel@nongnu.org; Fri, 06 Mar 2026 05:15:00 -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 1vySCv-0002BS-LV for qemu-devel@nongnu.org; Fri, 06 Mar 2026 05:15:00 -0500 Received: from mail.maildlp.com (unknown [172.18.224.83]) by frasgout.his.huawei.com (SkyGuard) with ESMTPS id 4fS2LV0p64zHnHBW; Fri, 6 Mar 2026 18:13:54 +0800 (CST) Received: from dubpeml500008.china.huawei.com (unknown [7.214.146.94]) by mail.maildlp.com (Postfix) with ESMTPS id 8FA3D40572; Fri, 6 Mar 2026 18:14:53 +0800 (CST) Received: from P_UKIT01-A7bmah.china.huawei.com (10.195.246.67) 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, 6 Mar 2026 10:14:52 +0000 To: , , , , , CC: , Subject: [PATCH v2 1/3] hw/cxl: Fix handling of component ID to not assume it is a string Date: Fri, 6 Mar 2026 10:14:20 +0000 Message-ID: <20260306101423.986-2-shiju.jose@huawei.com> X-Mailer: git-send-email 2.43.0.windows.1 In-Reply-To: <20260306101423.986-1-shiju.jose@huawei.com> References: <20260306101423.986-1-shiju.jose@huawei.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Originating-IP: [10.195.246.67] X-ClientProxiedBy: lhrpeml100011.china.huawei.com (7.191.174.247) 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: -26 X-Spam_score: -2.7 X-Spam_bar: -- X-Spam_report: (-2.7 / 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_RPBL_BLOCKED=0.892, RCVD_IN_VALIDITY_SAFE_BLOCKED=0.622, 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: 1772792130571158500 Content-Type: text/plain; charset="utf-8" From: Shiju Jose Add following fixes, 1. Coverity reports a warning (CID 1645325) for use of strncpy() in handling of component ID. In cxl_create_mem_sparing_event_records(), fix handling of component ID to not assume it is a string by replacing strncpy with memcpy to solve this warning and copy the entire component ID data, which is 16 bytes. 2. In cxl_maintenance_insert(), - replace strncpy with memcpy to copy full data because component ID, which is 16 bytes data. - remove memset which is not required. Fixes: 5e5a86bab830("hw/cxl: Add support for Maintenance command and Post P= ackage Repair (PPR)") Closes ("https://lore.kernel.org/qemu-devel/CAFEAcA_CsVe4TUVm3o_-BA4hXvi2xA= ThGX5T97amgTQKW_kiYA@mail.gmail.com/") Reported-by: Peter Maydell Signed-off-by: Shiju Jose Reviewed-by: Jonathan Cameron --- 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 From nobody Mon Apr 13 12:34:26 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=1772792128; cv=none; d=zohomail.com; s=zohoarc; b=L2ceISpiNwSBbBQn1STnwUfS8pKAAQJreQWNwMBAUQpO9ay87JwXyn3wrEF1pUhhPnRYBNh/aHspUtiotxrJ/mdCSsDV6w+r+8OTHdOFefI/oJIz0SBR4ivb9RVbpzeQHhpv62K2XMwbpd6r4vXI4yB+s9WXgf0Z2FMHJQmjs6g= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1772792128; 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=lCRmM1kcIRAyoa8b8FOVaP/V6aB5cvGnkae0xMill5s=; b=lasyr3S3Kha5+vA7vyaEnhVhQ1r4y8wxWvCO3thsSN3Kb1+E+8J3mkU16PAMb8jyUrt8negRTA+ESJW+mdOAW5DvqKlBgvHHiDYaVKM3QmvNEW0+zD8HCKX4xnvz24SfLMdQ5kFRUi1tknMPEgjHTdLkQpXLOJGjV1mRAhtLu6A= 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 1772792128352746.4249656353207; Fri, 6 Mar 2026 02:15:28 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1vySD2-0002Na-Dg; Fri, 06 Mar 2026 05:15:04 -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 1vySCx-0002Mp-BT for qemu-devel@nongnu.org; Fri, 06 Mar 2026 05:14:59 -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 1vySCv-0002BU-DT for qemu-devel@nongnu.org; Fri, 06 Mar 2026 05:14:59 -0500 Received: from mail.maildlp.com (unknown [172.18.224.150]) by frasgout.his.huawei.com (SkyGuard) with ESMTPS id 4fS2Lw3ztJzJ46nP; Fri, 6 Mar 2026 18:14:16 +0800 (CST) Received: from dubpeml500008.china.huawei.com (unknown [7.214.146.94]) by mail.maildlp.com (Postfix) with ESMTPS id 5FD0240570; Fri, 6 Mar 2026 18:14:54 +0800 (CST) Received: from P_UKIT01-A7bmah.china.huawei.com (10.195.246.67) 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, 6 Mar 2026 10:14:53 +0000 To: , , , , , CC: , Subject: [PATCH v2 2/3] hw/cxl: Add fixes in Post Package Repair (PPR) Date: Fri, 6 Mar 2026 10:14:21 +0000 Message-ID: <20260306101423.986-3-shiju.jose@huawei.com> X-Mailer: git-send-email 2.43.0.windows.1 In-Reply-To: <20260306101423.986-1-shiju.jose@huawei.com> References: <20260306101423.986-1-shiju.jose@huawei.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Originating-IP: [10.195.246.67] X-ClientProxiedBy: lhrpeml100011.china.huawei.com (7.191.174.247) 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: -26 X-Spam_score: -2.7 X-Spam_bar: -- X-Spam_report: (-2.7 / 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_RPBL_BLOCKED=0.892, RCVD_IN_VALIDITY_SAFE_BLOCKED=0.622, 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: 1772792130546158500 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). In cxl_perform_ppr(), remove and free the maintenance entry from QLIST if match is found and PPR operation is performed. Fixes: 5e5a86bab830("hw/cxl: Add support for Maintenance command and Post P= ackage Repair (PPR)") Signed-off-by: Shiju Jose Reviewed-by: Jonathan Cameron --- hw/cxl/cxl-mailbox-utils.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/hw/cxl/cxl-mailbox-utils.c b/hw/cxl/cxl-mailbox-utils.c index 9c99422cd4..66a58396ee 100644 --- a/hw/cxl/cxl-mailbox-utils.c +++ b/hw/cxl/cxl-mailbox-utils.c @@ -2068,6 +2068,8 @@ static void cxl_perform_ppr(CXLType3Dev *ct3d, uint64= _t dpa) CXL_MEMDEV_MAINT_SUBCLASS_CACHELINE_SPARIN= G, ent, NULL); } + QLIST_REMOVE(ent, node); + g_free(ent); break; } } --=20 2.43.0 From nobody Mon Apr 13 12:34:26 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=1772792128; cv=none; d=zohomail.com; s=zohoarc; b=aswJ3znCJsm75BkEeGu6jDwXb5PqhcAXEKRN8eqwyrwrqxwzT0UKfLYFXH1hN4boIkOqJNRAybCG5fg12btb0Qque288wAbi1Q3NLwdUy95WH33HIA+4Fw9kJjh/ktBq69m/KiuE7GrxKxrSQBhvNBAyvEbZU+3kzmGshR/Luy8= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1772792128; 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=z7+cHftzroHTY72wRzKIOz86w+D1XMTAG9VD8GkLXdQ=; b=h/Pu0/VMB0UuAdIvNOiqO3cim4AWM2g4iR9dSVbM8pxWB0TKzT8jdZqMXR5vDfNYFMsJmrBKjhjdiLQ/5p7gAo4NEBOdWVwvi8//80NNK0uzOJNy9xDudAKfSrckKgEF6bZkJNZ3DI9L/c27D3QlesXT2QYMAlHSGOkm0r17abk= 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 1772792128873948.7022586160574; Fri, 6 Mar 2026 02:15:28 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1vySD2-0002O7-Mn; Fri, 06 Mar 2026 05:15:06 -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 1vySCy-0002N2-PW for qemu-devel@nongnu.org; Fri, 06 Mar 2026 05:15:00 -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 1vySCv-0002Bd-Eh for qemu-devel@nongnu.org; Fri, 06 Mar 2026 05:14:59 -0500 Received: from mail.maildlp.com (unknown [172.18.224.107]) by frasgout.his.huawei.com (SkyGuard) with ESMTPS id 4fS2LW4nmSzHnH7h; Fri, 6 Mar 2026 18:13:55 +0800 (CST) Received: from dubpeml500008.china.huawei.com (unknown [7.214.146.94]) by mail.maildlp.com (Postfix) with ESMTPS id 2739940584; Fri, 6 Mar 2026 18:14:55 +0800 (CST) Received: from P_UKIT01-A7bmah.china.huawei.com (10.195.246.67) 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, 6 Mar 2026 10:14:54 +0000 To: , , , , , CC: , Subject: [PATCH v2 3/3] hw/cxl/events: Fix handling of component ID in event records generation to not assume it is a string Date: Fri, 6 Mar 2026 10:14:22 +0000 Message-ID: <20260306101423.986-4-shiju.jose@huawei.com> X-Mailer: git-send-email 2.43.0.windows.1 In-Reply-To: <20260306101423.986-1-shiju.jose@huawei.com> References: <20260306101423.986-1-shiju.jose@huawei.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Originating-IP: [10.195.246.67] X-ClientProxiedBy: lhrpeml100011.china.huawei.com (7.191.174.247) 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: -26 X-Spam_score: -2.7 X-Spam_bar: -- X-Spam_report: (-2.7 / 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_RPBL_BLOCKED=0.892, RCVD_IN_VALIDITY_SAFE_BLOCKED=0.622, 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: 1772792130589158500 Content-Type: text/plain; charset="utf-8" From: Shiju Jose Fix handling of component ID in event records generation to not assume it is a string. Component ID in CXL events is 16 bytes data, but event record generation copy 15 bytes only from the qmp "component-id" field using strncpy. Replace strncpy with memcpy and copy the entire component ID data. Fixes: ea9b6d647f2f("hw/cxl/events: Add injection of General Media Events") Reviewed-by: Jonathan Cameron Signed-off-by: Shiju Jose --- hw/mem/cxl_type3.c | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/hw/mem/cxl_type3.c b/hw/mem/cxl_type3.c index 3cb1096e16..03a5d1751f 100644 --- a/hw/mem/cxl_type3.c +++ b/hw/mem/cxl_type3.c @@ -1895,8 +1895,7 @@ void qmp_cxl_inject_general_media_event(const char *p= ath, CxlEventLog log, } =20 if (component_id) { - strncpy((char *)gem.component_id, component_id, - sizeof(gem.component_id) - 1); + memcpy(gem.component_id, component_id, sizeof(gem.component_id)); valid_flags |=3D CXL_GMER_VALID_COMPONENT; if (has_comp_id_pldm && is_comp_id_pldm) { valid_flags |=3D CXL_GMER_VALID_COMPONENT_ID_FORMAT; @@ -2066,8 +2065,7 @@ void qmp_cxl_inject_dram_event(const char *path, CxlE= ventLog log, } =20 if (component_id) { - strncpy((char *)dram.component_id, component_id, - sizeof(dram.component_id) - 1); + memcpy(dram.component_id, component_id, sizeof(dram.component_id)); valid_flags |=3D CXL_DRAM_VALID_COMPONENT; if (has_comp_id_pldm && is_comp_id_pldm) { valid_flags |=3D CXL_DRAM_VALID_COMPONENT_ID_FORMAT; @@ -2185,8 +2183,7 @@ void qmp_cxl_inject_memory_module_event(const char *p= ath, CxlEventLog log, corrected_persist_error_count); =20 if (component_id) { - strncpy((char *)module.component_id, component_id, - sizeof(module.component_id) - 1); + memcpy(module.component_id, component_id, sizeof(module.component_= id)); valid_flags |=3D CXL_MMER_VALID_COMPONENT; if (has_comp_id_pldm && is_comp_id_pldm) { valid_flags |=3D CXL_MMER_VALID_COMPONENT_ID_FORMAT; --=20 2.43.0