Patchwork virtio-9p: Fix the memset usage

login
register
mail settings
Submitter Aneesh Kumar K.V
Date June 30, 2010, 4:45 a.m.
Message ID <1277873129-8021-1-git-send-email-aneesh.kumar@linux.vnet.ibm.com>
Download mbox | patch
Permalink /patch/57373/
State New
Headers show

Comments

Aneesh Kumar K.V - June 30, 2010, 4:45 a.m.
The arguments are wrong. Use qemu_mallocz directly

Signed-off-by: Aneesh Kumar K.V <aneesh.kumar@linux.vnet.ibm.com>
---
 hw/virtio-9p.c |    3 +--
 1 files changed, 1 insertions(+), 2 deletions(-)
Sripathi Kodi - June 30, 2010, 5:15 a.m.
On Wed, 30 Jun 2010 10:15:29 +0530
"Aneesh Kumar K.V" <aneesh.kumar@linux.vnet.ibm.com> wrote:

> The arguments are wrong. Use qemu_mallocz directly
> 
> Signed-off-by: Aneesh Kumar K.V <aneesh.kumar@linux.vnet.ibm.com>

Reviewed-by: Sripathi Kodi <sripathik@in.ibm.com>

> ---
>  hw/virtio-9p.c |    3 +--
>  1 files changed, 1 insertions(+), 2 deletions(-)
> 
> diff --git a/hw/virtio-9p.c b/hw/virtio-9p.c
> index 5c5a34b..fba6619 100644
> --- a/hw/virtio-9p.c
> +++ b/hw/virtio-9p.c
> @@ -2782,8 +2782,7 @@ static void v9fs_wstat_post_chown(V9fsState *s, V9fsWstatState *vs, int err)
>      if (vs->v9stat.name.size != 0) {
>  	V9fsRenameState *vr;
> 
> -	vr = qemu_malloc(sizeof(V9fsRenameState));
> -	memset(vr, sizeof(*vr), 0);
> +	vr = qemu_mallocz(sizeof(V9fsRenameState));
>  	vr->newdirfid= -1;
>  	vr->pdu = vs->pdu;
>  	vr->fidp = vs->fidp;
> -- 
> 1.7.2.rc0
> 
>

Patch

diff --git a/hw/virtio-9p.c b/hw/virtio-9p.c
index 5c5a34b..fba6619 100644
--- a/hw/virtio-9p.c
+++ b/hw/virtio-9p.c
@@ -2782,8 +2782,7 @@  static void v9fs_wstat_post_chown(V9fsState *s, V9fsWstatState *vs, int err)
     if (vs->v9stat.name.size != 0) {
 	V9fsRenameState *vr;
 
-	vr = qemu_malloc(sizeof(V9fsRenameState));
-	memset(vr, sizeof(*vr), 0);
+	vr = qemu_mallocz(sizeof(V9fsRenameState));
 	vr->newdirfid= -1;
 	vr->pdu = vs->pdu;
 	vr->fidp = vs->fidp;