[PATCH 1/5] hw/acpi: Fix size of HID in build_append_srat_acpi_device_handle()

Jonathan Cameron via posted 5 patches 2 weeks, 5 days ago
[PATCH 1/5] hw/acpi: Fix size of HID in build_append_srat_acpi_device_handle()
Posted by Jonathan Cameron via 2 weeks, 5 days ago
The size should always be 8 so hard code that. By coincidience the
incorrect use of sizeof(char *) is 8 on 64 bit hosts, but was caught
by CI testing with i686 as the host.

Reported-by: Michael S. Tsirkin <mst@redhat.com>
Closes: https://lore.kernel.org/qemu-devel/20241104110025-mutt-send-email-mst@kernel.org/
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
---
 hw/acpi/aml-build.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/hw/acpi/aml-build.c b/hw/acpi/aml-build.c
index 6a76626177..72282b173e 100644
--- a/hw/acpi/aml-build.c
+++ b/hw/acpi/aml-build.c
@@ -1960,7 +1960,7 @@ static void build_append_srat_acpi_device_handle(GArray *table_data,
 {
     assert(strlen(hid) == 8);
     /* Device Handle - ACPI */
-    for (int i = 0; i < sizeof(hid); i++) {
+    for (int i = 0; i < 8; i++) {
         build_append_int_noprefix(table_data, hid[i], 1);
     }
     build_append_int_noprefix(table_data, uid, 4);
-- 
2.43.0
Re: [PATCH 1/5] hw/acpi: Fix size of HID in build_append_srat_acpi_device_handle()
Posted by Daniel P. Berrangé 2 weeks, 5 days ago
On Thu, Nov 07, 2024 at 12:34:42PM +0000, Jonathan Cameron wrote:
> The size should always be 8 so hard code that. By coincidience the
> incorrect use of sizeof(char *) is 8 on 64 bit hosts, but was caught
> by CI testing with i686 as the host.
> 
> Reported-by: Michael S. Tsirkin <mst@redhat.com>
> Closes: https://lore.kernel.org/qemu-devel/20241104110025-mutt-send-email-mst@kernel.org/
> Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
> ---
>  hw/acpi/aml-build.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)

Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>


With regards,
Daniel
-- 
|: https://berrange.com      -o-    https://www.flickr.com/photos/dberrange :|
|: https://libvirt.org         -o-            https://fstop138.berrange.com :|
|: https://entangle-photo.org    -o-    https://www.instagram.com/dberrange :|