[sheepdog] [PATCH] sheep/ops: fix potential type conversion error

Liu Yuan namei.unix at gmail.com
Tue Apr 22 08:15:49 CEST 2014


On Mon, Apr 21, 2014 at 06:23:50PM +0800, Ruoyu wrote:
> Similar to lib/logger, epoch_log_read_with_timestamp will return -1
> for any failure and it cannot be assigned to a variable in type of
> size_t. Otherwise, the error branch will never be reached.
> 
> Signed-off-by: Ruoyu <liangry at ucweb.com>
> ---
>  sheep/ops.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/sheep/ops.c b/sheep/ops.c
> index 6db5c57..b9550f0 100644
> --- a/sheep/ops.c
> +++ b/sheep/ops.c
> @@ -449,7 +449,7 @@ static int local_stat_cluster(struct request *req)
>  	max_elogs = req->rq.data_length / sizeof(*elog);
>  	epoch = get_latest_epoch();
>  	for (i = 0; i < max_elogs; i++) {
> -		size_t nr_nodes;
> +		int nr_nodes;
>  
>  		if (epoch <= 0)
>  			break;
> -- 
> 1.8.3.2
> 
> 
> -- 
> sheepdog mailing list
> sheepdog at lists.wpkg.org
> http://lists.wpkg.org/mailman/listinfo/sheepdog

Thanks, this looks a fatal bug fix. I think stable branch should have it. Applied

Yuan



More information about the sheepdog mailing list