ftl_reloc: Fix scanbuild warning about moves.
/spdk/lib/ftl/ftl_reloc.c:507:8: warning: Assigned value is garbage or undefined move = moves[i]; ^ ~~~~~~~~ lib/ftl/ftl_reloc.c:508:11: warning: Access to field 'state' results in a dereference of a null pointer (loaded from variable 'move') switch (move->state) { ^~~~~~~~~~~ Change-Id: I9cc1c2b52a93957bb4c56b1ed463c23289b5a43d Signed-off-by: yidong0635 <dongx.yi@intel.com> Reviewed-on: https://review.gerrithub.io/c/spdk/spdk/+/460120 Reviewed-by: Paul Luse <paul.e.luse@intel.com> Reviewed-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com> Reviewed-by: Changpeng Liu <changpeng.liu@intel.com> Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
This commit is contained in:
parent
58f7449e15
commit
21740a7cac
@ -497,7 +497,7 @@ ftl_reloc_process_moves(struct ftl_band_reloc *breloc)
|
|||||||
{
|
{
|
||||||
int rc = 0;
|
int rc = 0;
|
||||||
size_t i, num_moves;
|
size_t i, num_moves;
|
||||||
struct ftl_reloc_move *moves[FTL_RELOC_MAX_MOVES];
|
struct ftl_reloc_move *moves[FTL_RELOC_MAX_MOVES] = {0};
|
||||||
struct ftl_reloc *reloc = breloc->parent;
|
struct ftl_reloc *reloc = breloc->parent;
|
||||||
struct ftl_reloc_move *move;
|
struct ftl_reloc_move *move;
|
||||||
|
|
||||||
@ -505,6 +505,7 @@ ftl_reloc_process_moves(struct ftl_band_reloc *breloc)
|
|||||||
|
|
||||||
for (i = 0; i < num_moves; ++i) {
|
for (i = 0; i < num_moves; ++i) {
|
||||||
move = moves[i];
|
move = moves[i];
|
||||||
|
assert(move != NULL);
|
||||||
switch (move->state) {
|
switch (move->state) {
|
||||||
case FTL_RELOC_STATE_READ_LBA_MAP:
|
case FTL_RELOC_STATE_READ_LBA_MAP:
|
||||||
rc = ftl_reloc_read_lba_map(breloc, move);
|
rc = ftl_reloc_read_lba_map(breloc, move);
|
||||||
|
Loading…
Reference in New Issue
Block a user