On 10/06/2017 08:50 PM, Philippe Mathieu-Daudé wrote:
> Signed-off-by: Philippe Mathieu-Daudé <f4...@amsat.org>
> ---
>  block/qcow2.c | 2 +-
>  block/vhdx.c  | 9 +++++----
>  2 files changed, 6 insertions(+), 5 deletions(-)
> 
> diff --git a/block/qcow2.c b/block/qcow2.c
> index f63d1831f8..3e7d6c81be 100644
> --- a/block/qcow2.c
> +++ b/block/qcow2.c
> @@ -2738,7 +2738,7 @@ static int qcow2_create2(const char *filename, int64_t 
> total_size,
>  
>      /* Write the header */
>      QEMU_BUILD_BUG_ON((1 << MIN_CLUSTER_BITS) < sizeof(*header));
> -    header = g_malloc0(cluster_size);
> +    header = g_malloc(cluster_size);

self-NACK since this is wrong.

>      *header = (QCowHeader) {
>          .magic                      = cpu_to_be32(QCOW_MAGIC),
>          .version                    = cpu_to_be32(version),
> diff --git a/block/vhdx.c b/block/vhdx.c
> index 8260fb46cd..91e532df8a 100644
> --- a/block/vhdx.c
> +++ b/block/vhdx.c
> @@ -244,10 +244,11 @@ static void vhdx_region_register(BDRVVHDXState *s,
>  {
>      VHDXRegionEntry *r;
>  
> -    r = g_new0(VHDXRegionEntry, 1);
> -
> -    r->start = start;
> -    r->end = start + length;
> +    r = g_new(VHDXRegionEntry, 1);
> +    *r = (VHDXRegionEntry) {
> +        .start = start,
> +        .end = start + length,

this is not wrong since all members are initialized, but it is not good
code practice (if the VHDXRegionEntry structure is expanded with another
member).

> +    };
>  
>      QLIST_INSERT_HEAD(&s->regions, r, entries);
>  }
> 

Reply via email to