[PATCH v2 1/3] qht: Zero-initialize qht_map

Peter Xu posted 3 patches 1 month ago
Maintainers: Paolo Bonzini <pbonzini@redhat.com>
[PATCH v2 1/3] qht: Zero-initialize qht_map
Posted by Peter Xu 1 month ago
QEMU almost always do this across the tree except QHT.  This prepares for
rcu to track double free.

Signed-off-by: Peter Xu <peterx@redhat.com>
---
 util/qht.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/util/qht.c b/util/qht.c
index 208c2f4b32..872d9f9cec 100644
--- a/util/qht.c
+++ b/util/qht.c
@@ -441,7 +441,7 @@ static struct qht_map *qht_map_create(size_t n_buckets)
     struct qht_map *map;
     size_t i;
 
-    map = g_malloc(sizeof(*map));
+    map = g_malloc0(sizeof(*map));
     map->n_buckets = n_buckets;
 
     map->n_added_buckets = 0;
-- 
2.50.1
Re: [PATCH v2 1/3] qht: Zero-initialize qht_map
Posted by Philippe Mathieu-Daudé 1 month ago
On 14/10/25 21:19, Peter Xu wrote:
> QEMU almost always do this across the tree except QHT.  This prepares for
> rcu to track double free.
> 
> Signed-off-by: Peter Xu <peterx@redhat.com>
> ---
>   util/qht.c | 2 +-
>   1 file changed, 1 insertion(+), 1 deletion(-)

Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org>