lib/ftl: check for null
Fixes #726. This prevents a segmentation fault by checking the pointer before accessing it. Change-Id: I18a3776fbcd6242c6efd1b88044debaa88c7342f Signed-off-by: Claire J. In <claire.in@circuitblvd.com> Reviewed-on: https://review.gerrithub.io/c/spdk/spdk/+/449591 Reviewed-by: wuzhouhui <wuzhouhui@kingsoft.com> Reviewed-by: Konrad Sztyber <konrad.sztyber@intel.com> Reviewed-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com> Reviewed-by: Darek Stojaczyk <dariusz.stojaczyk@intel.com> Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
This commit is contained in:
parent
643af88f13
commit
3be9febdf9
@ -256,6 +256,10 @@ ftl_io_erase_init(struct ftl_band *band, size_t lbk_cnt, spdk_ftl_fn cb)
|
||||
};
|
||||
|
||||
io = ftl_io_init_internal(&opts);
|
||||
if (!io) {
|
||||
return NULL;
|
||||
}
|
||||
|
||||
io->lbk_cnt = lbk_cnt;
|
||||
|
||||
return io;
|
||||
|
@ -454,7 +454,13 @@ ftl_reloc_io_init(struct ftl_band_reloc *breloc, struct ftl_io *io,
|
||||
}
|
||||
|
||||
io = ftl_io_init_internal(&opts);
|
||||
if (!io) {
|
||||
spdk_dma_free(opts.data);
|
||||
return -1;
|
||||
}
|
||||
|
||||
io->ppa = ppa;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user