summaryrefslogtreecommitdiff
path: root/drivers
diff options
context:
space:
mode:
authorJavier González <javier@javigon.com>2018-06-01 16:04:23 +0300
committerJens Axboe <axboe@kernel.dk>2018-06-01 16:43:53 +0300
commit6f9c9607d445a05267eb4830e5375535f5a547a2 (patch)
treec0b396d03dece80503fc00f093102d4c11e1a6db /drivers
parent8e55c07b2b9c24f1154dafd9a01befc00430df1e (diff)
downloadlinux-6f9c9607d445a05267eb4830e5375535f5a547a2.tar.xz
lightnvm: pblk: check for chunk size before allocating it
Do the check for the chunk state after making sure that the chunk type is supported. Fixes: 32ef9412c114 ("lightnvm: pblk: implement get log report chunk") Signed-off-by: Javier González <javier@cnexlabs.com> Signed-off-by: Matias Bjørling <mb@lightnvm.io> Signed-off-by: Jens Axboe <axboe@kernel.dk>
Diffstat (limited to 'drivers')
-rw-r--r--drivers/lightnvm/pblk-init.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/drivers/lightnvm/pblk-init.c b/drivers/lightnvm/pblk-init.c
index 1e1771864da0..81c103b341bd 100644
--- a/drivers/lightnvm/pblk-init.c
+++ b/drivers/lightnvm/pblk-init.c
@@ -751,14 +751,14 @@ static int pblk_setup_line_meta_20(struct pblk *pblk, struct pblk_line *line,
chunk->cnlb = chunk_meta->cnlb;
chunk->wp = chunk_meta->wp;
- if (!(chunk->state & NVM_CHK_ST_OFFLINE))
- continue;
-
if (chunk->type & NVM_CHK_TP_SZ_SPEC) {
WARN_ONCE(1, "pblk: custom-sized chunks unsupported\n");
continue;
}
+ if (!(chunk->state & NVM_CHK_ST_OFFLINE))
+ continue;
+
set_bit(pos, line->blk_bitmap);
nr_bad_chks++;
}