public inbox for linux-cxl@vger.kernel.org
 help / color / mirror / Atom feed
From: Jonathan Cameron <jonathan.cameron@huawei.com>
To: <shiju.jose@huawei.com>
Cc: <qemu-devel@nongnu.org>, <linux-cxl@vger.kernel.org>,
	<mst@redhat.com>, <peter.maydell@linaro.org>, <dave@stgolabs.net>,
	<linuxarm@huawei.com>
Subject: Re: [PATCH 3/3] hw/cxl/events: Fixes for component id in event records generation
Date: Thu, 5 Mar 2026 10:59:15 +0000	[thread overview]
Message-ID: <20260305105915.00000875@huawei.com> (raw)
In-Reply-To: <20260227223207.972-4-shiju.jose@huawei.com>

On Fri, 27 Feb 2026 22:32:06 +0000
<shiju.jose@huawei.com> wrote:

> From: Shiju Jose <shiju.jose@huawei.com>

As for patch 1, nice if the title suggests what is being fixed.
With that,
Reviewed-by: Jonathan Cameron <jonathan.cameron@huawei.com>

> 
> 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 change length of data to copy to the size of the
> component_id array (16 bytes).
> 
> Signed-off-by: Shiju Jose <shiju.jose@huawei.com>
> ---
>  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 *path, CxlEventLog log,
>      }
>  
>      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 |= CXL_GMER_VALID_COMPONENT;
>          if (has_comp_id_pldm && is_comp_id_pldm) {
>              valid_flags |= CXL_GMER_VALID_COMPONENT_ID_FORMAT;
> @@ -2066,8 +2065,7 @@ void qmp_cxl_inject_dram_event(const char *path, CxlEventLog log,
>      }
>  
>      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 |= CXL_DRAM_VALID_COMPONENT;
>          if (has_comp_id_pldm && is_comp_id_pldm) {
>              valid_flags |= CXL_DRAM_VALID_COMPONENT_ID_FORMAT;
> @@ -2185,8 +2183,7 @@ void qmp_cxl_inject_memory_module_event(const char *path, CxlEventLog log,
>               corrected_persist_error_count);
>  
>      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 |= CXL_MMER_VALID_COMPONENT;
>          if (has_comp_id_pldm && is_comp_id_pldm) {
>              valid_flags |= CXL_MMER_VALID_COMPONENT_ID_FORMAT;


      reply	other threads:[~2026-03-05 10:59 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-02-27 22:32 [PATCH 0/3] hw/cxl: Add fixes in maintenance, PPR and event records shiju.jose
2026-02-27 22:32 ` [PATCH 1/3] hw/cxl: Add fixes in maintenance and memory sparing shiju.jose
2026-03-05 10:57   ` Jonathan Cameron
2026-03-05 15:55     ` Shiju Jose
2026-02-27 22:32 ` [PATCH 2/3] hw/cxl: Add fixes in Post Package Repair (PPR) shiju.jose
2026-03-06  9:01   ` Jonathan Cameron
2026-02-27 22:32 ` [PATCH 3/3] hw/cxl/events: Fixes for component id in event records generation shiju.jose
2026-03-05 10:59   ` Jonathan Cameron [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20260305105915.00000875@huawei.com \
    --to=jonathan.cameron@huawei.com \
    --cc=dave@stgolabs.net \
    --cc=linux-cxl@vger.kernel.org \
    --cc=linuxarm@huawei.com \
    --cc=mst@redhat.com \
    --cc=peter.maydell@linaro.org \
    --cc=qemu-devel@nongnu.org \
    --cc=shiju.jose@huawei.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox