[Ocfs2-tools-devel] [PATCH] libocfs2: avoid return a undefined or garbage value to caller
chuanchang.jia at gmail.com
chuanchang.jia at gmail.com
Sat Sep 17 19:02:58 PDT 2011
Variable 'ret' declared without an initial value, when 'while' loop
condition is false, and two if statements are also, the function
create_chainalloc_region will directly return 'ret', a undefined or
garbage value will be returned to caller.
Signed-off-by: Alex Jia <chuanchang.jia at gmail.com>
---
libocfs2/chainalloc.c | 2 +-
1 files changed, 1 insertions(+), 1 deletions(-)
diff --git a/libocfs2/chainalloc.c b/libocfs2/chainalloc.c
index 6ee353d..f886725 100644
--- a/libocfs2/chainalloc.c
+++ b/libocfs2/chainalloc.c
@@ -156,7 +156,7 @@ static errcode_t create_chainalloc_region(ocfs2_filesys *fs,
struct ocfs2_group_desc *gd,
struct chainalloc_bitmap_private *cb)
{
- errcode_t ret;
+ errcode_t ret = 0;
int total_bits = gd->bg_bits;
int region_bits = 0, bit_offset = 0, set_bits = 0;
uint64_t start_bit;
--
1.7.1
More information about the Ocfs2-tools-devel
mailing list