[sheepdog-users] [PATCH stable-0.7 1/2] dog: fix improper typed 'ret' in 'vdi create'

Hitoshi Mitake mitake.hitoshi at lab.ntt.co.jp
Wed Jan 29 11:26:47 CET 2014


From: Liu Yuan <namei.unix at gmail.com>

'ret' is unsigned then never get < 0 even in error case, so for a wrong size, we
will proceed to create an invalid vdi.

Reviewed-by: Hitoshi Mitake <mitake.hitoshi at lab.ntt.co.jp>
Signed-off-by: Liu Yuan <namei.unix at gmail.com>

Conflicts:
	dog/vdi.c

Conflicts were resolved by Hitoshi Mitake.
Signed-off-by: Hitoshi Mitake <mitake.hitoshi at lab.ntt.co.jp>
---
 dog/vdi.c |    3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/dog/vdi.c b/dog/vdi.c
index aef37d1..998ccd0 100644
--- a/dog/vdi.c
+++ b/dog/vdi.c
@@ -497,8 +497,9 @@ static int vdi_create(int argc, char **argv)
 	uint64_t size;
 	uint32_t vid;
 	uint64_t oid;
-	int idx, max_idx, ret, nr_copies = vdi_cmd_data.nr_copies;
+	uint32_t idx, max_idx, nr_copies = vdi_cmd_data.nr_copies;
 	struct sd_inode *inode = NULL;
+	int ret;
 
 	if (!argv[optind]) {
 		sd_err("Please specify the VDI size");
-- 
1.7.10.4




More information about the sheepdog-users mailing list