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

Hitoshi Mitake mitake.hitoshi at gmail.com
Mon Aug 10 14:11:45 CEST 2015


At Mon, 10 Aug 2015 20:53:02 +0800,
hongzhou zhang wrote:
> 
> 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(-)

Applied, thanks. Currently, we are using github PR for
development. Could you send PR on github instead of email from next
time?

Thanks,
Hitoshi

> 
> 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
> 
> -- 
> sheepdog mailing list
> sheepdog at lists.wpkg.org
> https://lists.wpkg.org/mailman/listinfo/sheepdog


More information about the sheepdog mailing list