[Ocfs2-tools-devel] [PATCH] libocfs2: avoid assigning a garbage or undefined value

Sunil Mushran sunil.mushran at oracle.com
Mon Sep 19 09:32:55 PDT 2011


I think I reviewed all the patches. The ones I have not replied to are correct.
Please can you collect the relevant changes into one patch and call it....
tools: Build related fixes

Thanks
Sunil

On 09/17/2011 07:02 PM, chuanchang.jia at gmail.com wrote:
> Variable 'blkno' declared without an initial value, the codes are taking true
> branch of 'if (dx_root->dr_flags&  OCFS2_DX_FLAG_INLINE)' and loop body of
> 'for (i = 0; i<  entry_list->de_num_used; i++) {', and then entering
> 'if (!(dx_root->dr_flags&  OCFS2_DX_FLAG_INLINE)) {' true branch,
> 'lookup->dl_dx_leaf_blkno' will be assigned a value is garbage or undefined.
>
> Signed-off-by: Alex Jia<chuanchang.jia at gmail.com>
> ---
>   libocfs2/dir_indexed.c |    2 +-
>   1 files changed, 1 insertions(+), 1 deletions(-)
>
> diff --git a/libocfs2/dir_indexed.c b/libocfs2/dir_indexed.c
> index a195ea5..29173c9 100644
> --- a/libocfs2/dir_indexed.c
> +++ b/libocfs2/dir_indexed.c
> @@ -1413,7 +1413,7 @@ errcode_t ocfs2_dx_dir_search(ocfs2_filesys *fs,
>   	struct ocfs2_dx_entry *dx_entry;
>   	struct ocfs2_dir_entry *dir_ent;
>   	uint32_t leaf_cpos;
> -	uint64_t blkno;
> +	uint64_t blkno = 0;
>   	int i, found;
>
>   	if (dx_root->dr_flags&  OCFS2_DX_FLAG_INLINE)




More information about the Ocfs2-tools-devel mailing list