Skip to contentSkip to conversation

hw/vfio/platform: replace g_malloc0_n by g_new0

PATCH Applied Eric Auger 4 participants 5 messages Jun 11, 2015

lore
Share & tools
lore

Eric Auger

author
#0 lore raw

PATCH v2 1/1 hw/vfio/platform: replace g_malloc0_n by g_new0

g_malloc0_n() is introduced since glib-2.24 while QEMU currently requires glib-2.22. This may cause a link error on some distributions.

---

v1 -> v2:
- replace g_malloc0 by g_new0

---
 hw/vfio/platform.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)
hw/vfio/platform.c +1 -2
index 35266a8..9382bb7 100644
@@ -346,8 +346,7 @@ static int vfio_populate_device(VFIODevice *vbasedev)
         return ret;
     }
 
-    vdev->regions = g_malloc0_n(vbasedev->num_regions,
-                                sizeof(VFIORegion *));
+    vdev->regions = g_new0(VFIORegion *, vbasedev->num_regions);
 
     for (i = 0; i < vbasedev->num_regions; i++) {
         struct vfio_region_info reg_info = { .argsz = sizeof(reg_info) };
Signature · 1 line
1.8.3.2
#1 lore raw
Quoted 28 lines · Eric Auger

g_malloc0_n() is introduced since glib-2.24 while QEMU currently requires glib-2.22. This may cause a link error on some distributions.

---

v1 -> v2:
- replace g_malloc0 by g_new0

---
 hw/vfio/platform.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)
hw/vfio/platform.c +1 -3
index 35266a8..9382bb7 100644
@@ -346,8 +346,7 @@ static int vfio_populate_device(VFIODevice *vbasedev)
         return ret;
     }
 
-    vdev->regions = g_malloc0_n(vbasedev->num_regions,
-                                sizeof(VFIORegion *));
+    vdev->regions = g_new0(VFIORegion *, vbasedev->num_regions);
 
     for (i = 0; i < vbasedev->num_regions; i++) {
         struct vfio_region_info reg_info = { .argsz = sizeof(reg_info) };
--
Quoted 1 line

1.8.3.2

This looks like the right fix to me -- if somebody would like to give it a reviewed-by tag I can apply it to master as a buildfix...

thanks
-- PMM

Reviewed-by
#2 lore raw
Quoted 26 lines · Peter Maydell
Quoted 25 lines · Eric Auger

g_malloc0_n() is introduced since glib-2.24 while QEMU currently requires glib-2.22. This may cause a link error on some distributions.

---

v1 -> v2:
- replace g_malloc0 by g_new0

---
 hw/vfio/platform.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)
hw/vfio/platform.c +1 -2
index 35266a8..9382bb7 100644
@@ -346,8 +346,7 @@ static int vfio_populate_device(VFIODevice *vbasedev)
         return ret;
     }
 
-    vdev->regions = g_malloc0_n(vbasedev->num_regions,
-                                sizeof(VFIORegion *));
+    vdev->regions = g_new0(VFIORegion *, vbasedev->num_regions);
 
Quoted 8 lines
Quoted 4 lines
hw/vfio/platform.c +0 -1
     for (i = 0; i < vbasedev->num_regions; i++) {
         struct vfio_region_info reg_info = { .argsz = sizeof(reg_info) };
--

1.8.3.2

This looks like the right fix to me -- if somebody would like to give it a reviewed-by tag I can apply it to master as a buildfix...

Yes, please.

#3 lore raw
In reply to Peter Maydell
Quoted 26 lines · Peter Maydell
Quoted 25 lines · Eric Auger

g_malloc0_n() is introduced since glib-2.24 while QEMU currently requires glib-2.22. This may cause a link error on some distributions.

---

v1 -> v2:
- replace g_malloc0 by g_new0

---
 hw/vfio/platform.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)
hw/vfio/platform.c +1 -2
index 35266a8..9382bb7 100644
@@ -346,8 +346,7 @@ static int vfio_populate_device(VFIODevice *vbasedev)
         return ret;
     }
 
-    vdev->regions = g_malloc0_n(vbasedev->num_regions,
-                                sizeof(VFIORegion *));
+    vdev->regions = g_new0(VFIORegion *, vbasedev->num_regions);
 
Quoted 7 lines
Quoted 4 lines
hw/vfio/platform.c +0 -1
     for (i = 0; i < vbasedev->num_regions; i++) {
         struct vfio_region_info reg_info = { .argsz = sizeof(reg_info) };
--

1.8.3.2

This looks like the right fix to me -- if somebody would like to give it a reviewed-by tag I can apply it to master as a buildfix...

Thanks Peter

#4 lore raw
Quoted 35 lines · Alex Williamson
Quoted 26 lines · Peter Maydell
Quoted 25 lines · Eric Auger

g_malloc0_n() is introduced since glib-2.24 while QEMU currently requires glib-2.22. This may cause a link error on some distributions.

---

v1 -> v2:
- replace g_malloc0 by g_new0

---
 hw/vfio/platform.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)
hw/vfio/platform.c +1 -2
index 35266a8..9382bb7 100644
@@ -346,8 +346,7 @@ static int vfio_populate_device(VFIODevice *vbasedev)
         return ret;
     }
 
-    vdev->regions = g_malloc0_n(vbasedev->num_regions,
-                                sizeof(VFIORegion *));
+    vdev->regions = g_new0(VFIORegion *, vbasedev->num_regions);
 
Quoted 7 lines
Quoted 4 lines
hw/vfio/platform.c +0 -1
     for (i = 0; i < vbasedev->num_regions; i++) {
         struct vfio_region_info reg_info = { .argsz = sizeof(reg_info) };
--

1.8.3.2

This looks like the right fix to me -- if somebody would like to give it a reviewed-by tag I can apply it to master as a buildfix...

Quoted 3 lines

Thanks Peter

Applied, thanks.

-- PMM