[sheepdog] [PATCH] sheep/gateway Remove warning ‘nr_vids’ may be used uninitialized in this function

hongzhou zhang zhang.hongzhou at hotmail.com
Mon Aug 10 14:53:02 CEST 2015


From: zhanghongzhou <hongzhou.h.zhang at intel.com>

gateway.c:696: warning: ‘nr_vids’ may be used uninitialized in this function

Signed-off-by: Hongzhou Zhang <hongzhou.h.zhang at intel.com>
---
 sheep/gateway.c |    4 +---
 1 files changed, 1 insertions(+), 3 deletions(-)

diff --git a/sheep/gateway.c b/sheep/gateway.c
index af7fce4..f31e129 100644
--- a/sheep/gateway.c
+++ b/sheep/gateway.c
@@ -693,7 +693,7 @@ int gateway_write_obj(struct request *req)
 	uint32_t *vids = NULL, *new_vids = req->data;
 	struct generation_reference *refs = NULL, *zeroed_refs = NULL;
 	struct update_obj_refcnt_work *refcnt_work;
-	size_t nr_vids;
+	size_t nr_vids = hdr->data_length / sizeof(*vids);
 
 	if ((req->rq.flags & SD_FLAG_CMD_TGT) &&
 	    is_refresh_required(oid_to_vid(oid))) {
@@ -709,8 +709,6 @@ int gateway_write_obj(struct request *req)
 
 
 	if (is_data_vid_update(hdr)) {
-		nr_vids = hdr->data_length / sizeof(*vids);
-
 		invalidate_other_nodes(oid_to_vid(oid));
 
 		/* read the previous vids to discard their references later */
-- 
1.7.1



More information about the sheepdog mailing list