[Qemu-devel] [PATCH v2 16/45] q35: fix get_mmcfg_size to use uint64 visitor

Marc-André Lureau posted 45 patches 8 years, 8 months ago
There is a newer version of this series
[Qemu-devel] [PATCH v2 16/45] q35: fix get_mmcfg_size to use uint64 visitor
Posted by Marc-André Lureau 8 years, 8 months ago
e->size is hwaddr, i.e. uint64_t. We silently truncate.
Fix suggested by Markus Armbruster.

Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
---
 hw/pci-host/q35.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/hw/pci-host/q35.c b/hw/pci-host/q35.c
index cd5c49616e..e8a04d31d1 100644
--- a/hw/pci-host/q35.c
+++ b/hw/pci-host/q35.c
@@ -129,9 +129,8 @@ static void q35_host_get_mmcfg_size(Object *obj, Visitor *v, const char *name,
                                     void *opaque, Error **errp)
 {
     PCIExpressHost *e = PCIE_HOST_BRIDGE(obj);
-    uint32_t value = e->size;
 
-    visit_type_uint32(v, name, &value, errp);
+    visit_type_uint64(v, name, &e->size, errp);
 }
 
 static Property mch_props[] = {
-- 
2.13.0.91.g00982b8dd


Re: [Qemu-devel] [PATCH v2 16/45] q35: fix get_mmcfg_size to use uint64 visitor
Posted by Markus Armbruster 8 years, 8 months ago
Marc-André Lureau <marcandre.lureau@redhat.com> writes:

> e->size is hwaddr, i.e. uint64_t. We silently truncate.
> Fix suggested by Markus Armbruster.

I'd prefer

  Suggested-by: Markus Armbruster <armbru@redhat.com>

> Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
> ---
>  hw/pci-host/q35.c | 3 +--
>  1 file changed, 1 insertion(+), 2 deletions(-)
>
> diff --git a/hw/pci-host/q35.c b/hw/pci-host/q35.c
> index cd5c49616e..e8a04d31d1 100644
> --- a/hw/pci-host/q35.c
> +++ b/hw/pci-host/q35.c
> @@ -129,9 +129,8 @@ static void q35_host_get_mmcfg_size(Object *obj, Visitor *v, const char *name,
>                                      void *opaque, Error **errp)
>  {
>      PCIExpressHost *e = PCIE_HOST_BRIDGE(obj);
> -    uint32_t value = e->size;
>  
> -    visit_type_uint32(v, name, &value, errp);
> +    visit_type_uint64(v, name, &e->size, errp);
>  }
>  
>  static Property mch_props[] = {

Reviewed-by: Markus Armbruster <armbru@redhat.com>