Validate lbat element length on read
This commit is contained in:
parent
f1bb01ab48
commit
9f9722bb26
|
@ -431,6 +431,12 @@ lbd_read(struct lbd* lbd)
|
|||
nr_pblk = (lbd->c_len == CBD_UNCOMPRESSED) ?
|
||||
lblk_per_pblk(&lbd->kparams->params) :
|
||||
DIV_ROUND_UP(lbd->c_len, pblk_size(&lbd->kparams->params));
|
||||
if (nr_pblk > lblk_per_pblk(&lbd->kparams->params)) {
|
||||
printk(KERN_ERR "%s: elem len %u out of range at lblk=%lu\n",
|
||||
__func__, lbd->c_len, (unsigned long)lbd->lblk);
|
||||
ret = -EIO;
|
||||
goto out;
|
||||
}
|
||||
for (pblk_idx = 0, pg_idx = 0; pblk_idx < nr_pblk; ++pg_idx) {
|
||||
iov_len = min(nr_pblk - pblk_idx, pblk_per_page);
|
||||
for (n = 0; n < iov_len; ++n) {
|
||||
|
|
Loading…
Reference in New Issue