summaryrefslogtreecommitdiffstats
path: root/drivers/lightnvm
diff options
context:
space:
mode:
authorDan Carpenter <dan.carpenter@oracle.com>2017-04-21 16:48:40 -0600
committerJens Axboe <axboe@fb.com>2017-04-21 16:48:40 -0600
commit5bf1e1ee6269f4db307bdfce45d196d6c9bc818a (patch)
treed2d18834ddcd94e3d30a80aae4517b49aaf0ebad /drivers/lightnvm
parent19b7ccf8651df09d274671b53039c672a52ad84d (diff)
downloadlinux-stable-5bf1e1ee6269f4db307bdfce45d196d6c9bc818a.tar.gz
linux-stable-5bf1e1ee6269f4db307bdfce45d196d6c9bc818a.tar.bz2
linux-stable-5bf1e1ee6269f4db307bdfce45d196d6c9bc818a.zip
lightnvm: potential underflow in pblk_read_rq()
This is a static checker fix, and perhaps not a real bug. The static checker thinks that nr_secs could be negative. It would result in zeroing more memory than intended. Anyway, even if it's not a bug, changing this variable to unsigned makes the code easier to audit. Fixes: a4bd217b4326 ("lightnvm: physical block device (pblk) target") Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com> Reviewed-by: Javier González <javier@cnexlabs.com> Signed-off-by: Jens Axboe <axboe@fb.com>
Diffstat (limited to 'drivers/lightnvm')
-rw-r--r--drivers/lightnvm/pblk-read.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/drivers/lightnvm/pblk-read.c b/drivers/lightnvm/pblk-read.c
index bce7ed5fc73f..c9daa33e8d9c 100644
--- a/drivers/lightnvm/pblk-read.c
+++ b/drivers/lightnvm/pblk-read.c
@@ -288,7 +288,7 @@ retry:
int pblk_submit_read(struct pblk *pblk, struct bio *bio)
{
struct nvm_tgt_dev *dev = pblk->dev;
- int nr_secs = pblk_get_secs(bio);
+ unsigned int nr_secs = pblk_get_secs(bio);
struct nvm_rq *rqd;
unsigned long read_bitmap; /* Max 64 ppas per request */
unsigned int bio_init_idx;