summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--drivers/lightnvm/pblk.h7
1 files changed, 5 insertions, 2 deletions
diff --git a/drivers/lightnvm/pblk.h b/drivers/lightnvm/pblk.h
index bc40b1381ff6..85e38ed62f85 100644
--- a/drivers/lightnvm/pblk.h
+++ b/drivers/lightnvm/pblk.h
@@ -1388,12 +1388,15 @@ static inline unsigned int pblk_get_min_chks(struct pblk *pblk)
static inline struct pblk_sec_meta *pblk_get_meta(struct pblk *pblk,
void *meta, int index)
{
- return meta + pblk->oob_meta_size * index;
+ return meta +
+ max_t(int, sizeof(struct pblk_sec_meta), pblk->oob_meta_size)
+ * index;
}
static inline int pblk_dma_meta_size(struct pblk *pblk)
{
- return pblk->oob_meta_size * NVM_MAX_VLBA;
+ return max_t(int, sizeof(struct pblk_sec_meta), pblk->oob_meta_size)
+ * NVM_MAX_VLBA;
}
static inline int pblk_is_oob_meta_supported(struct pblk *pblk)