bb_count would be 0 if util_region_badblocks_to_json() returns NULL.
Initialize bb_count to 0 by default.

Reported-by: Andy Rudoff <[email protected]>
Signed-off-by: Dave Jiang <[email protected]>
---
 ndctl/list.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/ndctl/list.c b/ndctl/list.c
index 4d5050c..ad710ed 100644
--- a/ndctl/list.c
+++ b/ndctl/list.c
@@ -138,7 +138,7 @@ static struct json_object *region_to_json(struct 
ndctl_region *region,
        struct json_object *jobj, *jbbs, *jmappings = NULL;
        struct ndctl_interleave_set *iset;
        struct ndctl_mapping *mapping;
-       unsigned int bb_count;
+       unsigned int bb_count = 0;
 
        if (!jregion)
                return NULL;

_______________________________________________
Linux-nvdimm mailing list
[email protected]
https://lists.01.org/mailman/listinfo/linux-nvdimm

Reply via email to