summary refs log tree commit diff stats
path: root/hw/cxl/cxl-cdat.c
diff options
context:
space:
mode:
authorThomas Huth <thuth@redhat.com>2024-03-04 11:44:04 +0100
committerMichael Tokarev <mjt@tls.msk.ru>2024-03-09 18:56:37 +0300
commitc4e898d502549025e087aa799211a5c6bd3984ff (patch)
tree49229ebfeeea0e0326f7a121fee7b74b1b9406d7 /hw/cxl/cxl-cdat.c
parentb1614f795f0dcacee181f8eefc9572f661ef3adc (diff)
downloadfocaccia-qemu-c4e898d502549025e087aa799211a5c6bd3984ff.tar.gz
focaccia-qemu-c4e898d502549025e087aa799211a5c6bd3984ff.zip
hw/cxl/cxl-cdat: Fix type of buf in ct3_load_cdat()
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>
Reviewed-by: Michael Tokarev <mjt@tls.msk.ru>
Signed-off-by: Michael Tokarev <mjt@tls.msk.ru>
Diffstat (limited to 'hw/cxl/cxl-cdat.c')
-rw-r--r--hw/cxl/cxl-cdat.c4
1 files 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++];
         }