[Sheepdog] [PATCH] sheep, journal: check ret before calling into jrnl_handlers

MORITA Kazutaka morita.kazutaka at lab.ntt.co.jp
Thu Sep 1 11:15:58 CEST 2011


At Wed, 31 Aug 2011 15:23:13 +0800,
Liu Yuan wrote:
> 
> From: Liu Yuan <tailai.ly at taobao.com>
> 
> We should do this sanity check to avoid possible segmentation
> fault or further wrong code path, because in error case,
> jrnl_type is incorrect.
> 
> Signed-off-by: Liu Yuan <tailai.ly at taobao.com>
> ---
>  sheep/store.c |    2 ++
>  1 files changed, 2 insertions(+), 0 deletions(-)

Applied, thanks!

Kazutaka

> 
> diff --git a/sheep/store.c b/sheep/store.c
> index 79a1af3..d192557 100644
> --- a/sheep/store.c
> +++ b/sheep/store.c
> @@ -2241,6 +2241,8 @@ inline int jrnl_apply_to_target_object(struct jrnl_file_desc *jfd)
>  	uint32_t jrnl_type;
>  
>  	ret = jrnl_get_type_from_file(jfd, &jrnl_type);
> +	if (ret)
> +		return ret;
>  
>  	return jrnl_handlers[jrnl_type].apply_to_target_object(jfd);
>  }
> -- 
> 1.7.5.1
> 
> -- 
> sheepdog mailing list
> sheepdog at lists.wpkg.org
> http://lists.wpkg.org/mailman/listinfo/sheepdog



More information about the sheepdog mailing list