hw/9pfs: Initialize rest of qid field to zero.
authorAneesh Kumar K.V <aneesh.kumar@linux.vnet.ibm.com>
Tue, 2 Aug 2011 06:06:24 +0000 (11:36 +0530)
committerAneesh Kumar K.V <aneesh.kumar@linux.vnet.ibm.com>
Fri, 9 Sep 2011 09:15:55 +0000 (14:45 +0530)
Since qid is allocated out of stack we need to intialize
the field to zero. Otherwise we will send wrong qid value
to client.

Signed-off-by: Aneesh Kumar K.V <aneesh.kumar@linux.vnet.ibm.com>
hw/9pfs/virtio-9p.c

index 71bc51b3cae05e402e6537d3e3850cce81d18b9b..91e095751235b8904c7a0a95ecee0ba110f20fec 100644 (file)
@@ -543,6 +543,7 @@ static void stat_to_qid(const struct stat *stbuf, V9fsQID *qidp)
 {
     size_t size;
 
+    memset(&qidp->path, 0, sizeof(qidp->path));
     size = MIN(sizeof(stbuf->st_ino), sizeof(qidp->path));
     memcpy(&qidp->path, &stbuf->st_ino, size);
     qidp->version = stbuf->st_mtime ^ (stbuf->st_size << 8);