[sheepdog] [PATCH v2 1/2] dog: fix wrong use of argument for dog_exec_req()

Robin Dong robin.k.dong at gmail.com
Thu Jan 2 08:51:00 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.

Signed-off-by: Robin Dong <sanbai at taobao.com>
---
 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 43df232..9d60202 100644
--- a/dog/cluster.c
+++ b/dog/cluster.c
@@ -96,7 +96,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(&sd_nid, &hdr, &vdi_inuse);
+	ret = dog_exec_req(&sd_nid, &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 546690a..828ed1d 100644
--- a/dog/common.c
+++ b/dog/common.c
@@ -141,7 +141,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(&sd_nid, &req, &vdi_inuse);
+	ret = dog_exec_req(&sd_nid, &req, vdi_inuse);
 	if (ret < 0)
 		goto out;
 	if (rsp->result != SD_RES_SUCCESS) {
-- 
1.7.12.4




More information about the sheepdog mailing list