[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PULL 08/11] hw/cxl/cxl-cdat: Fix type of buf in ct3_load_cdat()
From: |
Michael Tokarev |
Subject: |
[PULL 08/11] hw/cxl/cxl-cdat: Fix type of buf in ct3_load_cdat() |
Date: |
Sat, 9 Mar 2024 18:57:26 +0300 |
From: Thomas Huth <thuth@redhat.com>
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>
---
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++];
}
--
2.39.2
- [PULL 00/11] Trivial patches for 2024-03-09, Michael Tokarev, 2024/03/09
- [PULL 01/11] replay: Improve error messages about configuration conflicts, Michael Tokarev, 2024/03/09
- [PULL 02/11] hw/vfio/pci.c: Make some structure static, Michael Tokarev, 2024/03/09
- [PULL 03/11] hw/scsi/lsi53c895a: Fix typo in comment, Michael Tokarev, 2024/03/09
- [PULL 04/11] make-release: switch to .xz format by default, Michael Tokarev, 2024/03/09
- [PULL 05/11] char: Slightly better error reporting when chardev is in use, Michael Tokarev, 2024/03/09
- [PULL 06/11] blockdev: Fix block_resize error reporting for op blockers, Michael Tokarev, 2024/03/09
- [PULL 07/11] qerror: QERR_DEVICE_IN_USE is no longer used, drop, Michael Tokarev, 2024/03/09
- [PULL 08/11] hw/cxl/cxl-cdat: Fix type of buf in ct3_load_cdat(),
Michael Tokarev <=
- [PULL 09/11] hw/pci-bridge/cxl_upstream: Fix problem with g_steal_pointer(), Michael Tokarev, 2024/03/09
- [PULL 10/11] hw/mem/cxl_type3: Fix problem with g_steal_pointer(), Michael Tokarev, 2024/03/09
- [PULL 11/11] docs/acpi/bits: add some clarity and details while also improving formating, Michael Tokarev, 2024/03/09
- Re: [PULL 00/11] Trivial patches for 2024-03-09, Peter Maydell, 2024/03/10