[sheepdog] [PATCH stable-0.7] dog: fix wrong use of argument for dog_exec_req()

Hitoshi Mitake mitake.hitoshi at lab.ntt.co.jp
Mon Jan 6 10:43:56 CET 2014


From: Robin Dong <sanbai at taobao.com>

It should use argument 'vdi_inuse' for dog_exec_req() in
parse_vdi() and cluster_format() because 'vdi_inuse' is already the address
of a memory-space. It will cause data corruption in some non-x86 machines.

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

Conflicts:
	dog/cluster.c
	dog/common.c

Conflicts were resolved by Hitoshi Mitake.
Signed-off-by: Hitoshi Mitake <mitake.hitoshi at lab.ntt.co.jp>
---
 dog/cluster.c |    2 +-
 dog/common.c  |    2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/dog/cluster.c b/dog/cluster.c
index 2430765..6ee8dbf 100644
--- a/dog/cluster.c
+++ b/dog/cluster.c
@@ -82,7 +82,7 @@ static int cluster_format(int argc, char **argv)
 	sd_init_req(&hdr, SD_OP_READ_VDIS);
 	hdr.data_length = sizeof(vdi_inuse);
 
-	ret = dog_exec_req(sdhost, sdport, &hdr, &vdi_inuse);
+	ret = dog_exec_req(sdhost, sdport, &hdr, vdi_inuse);
 	if (ret < 0)
 		return EXIT_SYSFAIL;
 	if (rsp->result != SD_RES_SUCCESS) {
diff --git a/dog/common.c b/dog/common.c
index 006eeaa..fcd37f9 100644
--- a/dog/common.c
+++ b/dog/common.c
@@ -125,7 +125,7 @@ int parse_vdi(vdi_parser_func_t func, size_t size, void *data)
 	sd_init_req(&req, SD_OP_READ_VDIS);
 	req.data_length = sizeof(vdi_inuse);
 
-	ret = dog_exec_req(sdhost, sdport, &req, &vdi_inuse);
+	ret = dog_exec_req(sdhost, sdport, &req, vdi_inuse);
 	if (ret < 0)
 		goto out;
 	if (rsp->result != SD_RES_SUCCESS) {
-- 
1.7.10.4




More information about the sheepdog mailing list