OSDN Git Service

lightnvm: initialize ppa_addr in dev_to_generic_addr()
authorJavier González <javier@cnexlabs.com>
Thu, 7 Jul 2016 07:54:09 +0000 (09:54 +0200)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Sat, 2 Sep 2017 05:06:51 +0000 (07:06 +0200)
commit 5389a1dfb39786df08d4f6a482bd2734b1b50e33 upstream.

The ->reserved bit is not initialized when allocated on stack.
This may lead targets to misinterpret the PPA as cached.

Signed-off-by: Javier González <javier@cnexlabs.com>
Signed-off-by: Matias Bjørling <m@bjorling.me>
Signed-off-by: Jens Axboe <axboe@fb.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
include/linux/lightnvm.h

index 782d4e8..4bc4b1b 100644 (file)
@@ -310,6 +310,7 @@ static inline struct ppa_addr dev_to_generic_addr(struct nvm_dev *dev,
 {
        struct ppa_addr l;
 
+       l.ppa = 0;
        /*
         * (r.ppa << X offset) & X len bitmask. X eq. blk, pg, etc.
         */