]> git.kernelconcepts.de Git - karo-tx-linux.git/commitdiff
lightnvm: potential underflow in pblk_read_rq()
authorDan Carpenter <dan.carpenter@oracle.com>
Fri, 21 Apr 2017 22:48:40 +0000 (16:48 -0600)
committerJens Axboe <axboe@fb.com>
Fri, 21 Apr 2017 22:48:40 +0000 (16:48 -0600)
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>
drivers/lightnvm/pblk-read.c

index bce7ed5fc73f32f4f4b33c1dc19b460c4ef00888..c9daa33e8d9ce50a5469df314c478a298a00d5d2 100644 (file)
@@ -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;