qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Qemu-devel] [PATCH v3 1/6] vmdk: Use g_random_int to generate CID


From: Max Reitz
Subject: Re: [Qemu-devel] [PATCH v3 1/6] vmdk: Use g_random_int to generate CID
Date: Wed, 03 Dec 2014 15:11:35 +0100
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:31.0) Gecko/20100101 Thunderbird/31.2.0

On 2014-12-03 at 11:28, Fam Zheng wrote:
This replaces two "time(NULL)" invocations with "g_random_int()".
According to VMDK spec, CID "is a random 32‐bit value updated the first
time the content of the virtual disk is modified after the virtual disk
is opened". Using "seconds since epoch" is just a "lame way" to generate
it, and not completely safe because of the low precision.

Suggested-by: Markus Armbruster <address@hidden>
Signed-off-by: Fam Zheng <address@hidden>
Reviewed-by: Markus Armbruster <address@hidden>
---
  block/vmdk.c | 5 +++--
  1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/block/vmdk.c b/block/vmdk.c
index 2cbfd3e..ebb4b70 100644
--- a/block/vmdk.c
+++ b/block/vmdk.c
@@ -28,6 +28,7 @@
  #include "qemu/module.h"
  #include "migration/migration.h"
  #include <zlib.h>
+#include <glib.h>

This should be covered by qemu-common.h already. But anyway:

Reviewed-by: Max Reitz <address@hidden>



reply via email to

[Prev in Thread] Current Thread [Next in Thread]