btt_check_arenas: fix use of uninitialized variable
PATCH 1/1 btt_check_arenas: fix use of uninitialized variable
Coverity complains that rc, passed to btt_xlat_status, may be used uninitialized. In that case, we may also dereference a NULL pointer. Fix it by only calling btt_xlat_status with a valid arena.
ndctl/check.c +3 -2
@@ -582,9 +582,10 @@ static int btt_check_arenas(struct btt_chk *bttc)break ; } -btt_xlat_status (a, rc); -if (rc) +if (a && rc !=BTT_OK ) { +btt_xlat_status (a, rc);return -ENXIO ; + }return 0 ; }
_______________________________________________
Linux-nvdimm mailing list
[email protected]
https://lists.01.org/mailman/listinfo/linux-nvdimm
Quoted 6 lines · Jeff Moyer
Coverity complains that rc, passed to
btt_xlat_status, may be used uninitialized. In that case, we may also dereference a NULL pointer. Fix it by only callingbtt_xlat_statuswith a valid arena.Signed-off-by Jeff Moyer <[email protected]>
Good catch!
Quoted 18 lines
ndctl/check.c +3
-2@@ -582,9 +582,10 @@ static int btt_check_arenas(struct btt_chk *bttc)break ; } -btt_xlat_status (a, rc); -if (rc) +if (a && rc !=BTT_OK ) { +btt_xlat_status (a, rc);return -ENXIO ; + }return 0 ; }
Quoted 4 lines
_______________________________________________
Linux-nvdimm mailing list
[email protected]
https://lists.01.org/mailman/listinfo/linux-nvdimm
_______________________________________________
Linux-nvdimm mailing list
[email protected]
https://lists.01.org/mailman/listinfo/linux-nvdimm