qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Jonathan Cameron via <qemu-devel@nongnu.org>
To: Thomas Huth <thuth@redhat.com>
Cc: <qemu-devel@nongnu.org>, Fan Ni <fan.ni@samsung.com>,
	"Michael S. Tsirkin" <mst@redhat.com>,
	Marcel Apfelbaum <marcel.apfelbaum@gmail.com>,
	<qemu-trivial@nongnu.org>
Subject: Re: [PATCH 1/3] hw/cxl/cxl-cdat: Fix type of buf in ct3_load_cdat()
Date: Mon, 4 Mar 2024 14:57:04 +0000	[thread overview]
Message-ID: <20240304145704.00001ea3@Huawei.com> (raw)
In-Reply-To: <20240304104406.59855-2-thuth@redhat.com>

On Mon,  4 Mar 2024 11:44:04 +0100
Thomas Huth <thuth@redhat.com> wrote:

> When setting GLIB_VERSION_MAX_ALLOWED to GLIB_VERSION_2_58 or higher
> (which we'll certainly do in the not too distant future), glib adds
> type safety checks to the g_steal_pointer() macro. This trigger an
> error in the ct3_load_cdat() function: The local char *buf variable is
> assigned to uint8_t *buf in CDATObject, i.e. a pointer of a different
> type. Change the local variable to the same type as buf in CDATObject
> to avoid the error.
> 
> Signed-off-by: Thomas Huth <thuth@redhat.com>

Reviewed-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>

> ---
>  hw/cxl/cxl-cdat.c | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/hw/cxl/cxl-cdat.c b/hw/cxl/cxl-cdat.c
> index 2fea975671..551545f782 100644
> --- a/hw/cxl/cxl-cdat.c
> +++ b/hw/cxl/cxl-cdat.c
> @@ -114,7 +114,7 @@ static void ct3_build_cdat(CDATObject *cdat, Error **errp)
>  static void ct3_load_cdat(CDATObject *cdat, Error **errp)
>  {
>      g_autofree CDATEntry *cdat_st = NULL;
> -    g_autofree char *buf = NULL;
> +    g_autofree uint8_t *buf = NULL;
>      uint8_t sum = 0;
>      int num_ent;
>      int i = 0, ent = 1;
> @@ -171,7 +171,7 @@ static void ct3_load_cdat(CDATObject *cdat, Error **errp)
>          cdat_st[ent].base = hdr;
>          cdat_st[ent].length = hdr->length;
>  
> -        while (buf + i < (char *)cdat_st[ent].base + cdat_st[ent].length) {
> +        while (buf + i < (uint8_t *)cdat_st[ent].base + cdat_st[ent].length) {
>              assert(i < file_size);
>              sum += buf[i++];
>          }



  reply	other threads:[~2024-03-04 14:57 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-03-04 10:44 [PATCH 0/3] cxl: Fix issues with g_steal_pointer() Thomas Huth
2024-03-04 10:44 ` [PATCH 1/3] hw/cxl/cxl-cdat: Fix type of buf in ct3_load_cdat() Thomas Huth
2024-03-04 14:57   ` Jonathan Cameron via [this message]
2024-03-04 10:44 ` [PATCH 2/3] hw/pci-bridge/cxl_upstream: Fix problem with g_steal_pointer() Thomas Huth
2024-03-04 15:06   ` Jonathan Cameron via
2024-03-04 15:12     ` Jonathan Cameron via
2024-03-04 10:44 ` [PATCH 3/3] hw/mem/cxl_type3: " Thomas Huth
2024-03-04 15:10   ` Jonathan Cameron via
2024-03-05  7:27     ` Thomas Huth
2024-03-05 15:52       ` Jonathan Cameron via
2024-03-08  6:14 ` [PATCH 0/3] cxl: Fix issues " Michael Tokarev

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=20240304145704.00001ea3@Huawei.com \
    --to=qemu-devel@nongnu.org \
    --cc=Jonathan.Cameron@Huawei.com \
    --cc=fan.ni@samsung.com \
    --cc=marcel.apfelbaum@gmail.com \
    --cc=mst@redhat.com \
    --cc=qemu-trivial@nongnu.org \
    --cc=thuth@redhat.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;
as well as URLs for NNTP newsgroup(s).