diff mbox

ndctl: fix uninitialized bb_count in list command

Message ID 149686923837.13885.5048755294647675245.stgit@djiang5-desk3.ch.intel.com (mailing list archive)
State Accepted
Commit 076e4f77db5f
Headers show

Commit Message

Dave Jiang June 7, 2017, 9 p.m. UTC
bb_count would be 0 if util_region_badblocks_to_json() returns NULL.
Initialize bb_count to 0 by default.

Reported-by: Andy Rudoff <andy.rudoff@intel.com>
Signed-off-by: Dave Jiang <dave.jiang@intel.com>
---
 ndctl/list.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

Dan Williams June 7, 2017, 9:14 p.m. UTC | #1
On Wed, Jun 7, 2017 at 2:00 PM, Dave Jiang <dave.jiang@intel.com> wrote:
> bb_count would be 0 if util_region_badblocks_to_json() returns NULL.
> Initialize bb_count to 0 by default.
>
> Reported-by: Andy Rudoff <andy.rudoff@intel.com>
> Signed-off-by: Dave Jiang <dave.jiang@intel.com>

Thanks Dave! Applied and pushed out on the 'pending' branch.
diff mbox

Patch

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;