Add null check before dereferencing pointer dev_list inside
function nla_nest_end() at line 1968: nla_nest_end(reply, dev_list);

Addresses-Coverity-ID: 1408827
Signed-off-by: Gustavo A. R. Silva <garsi...@embeddedor.com>
---
 drivers/block/nbd.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/drivers/block/nbd.c b/drivers/block/nbd.c
index 9a7bb2c..6006de5 100644
--- a/drivers/block/nbd.c
+++ b/drivers/block/nbd.c
@@ -1948,6 +1948,9 @@ static int nbd_genl_status(struct sk_buff *skb, struct 
genl_info *info)
        }
 
        dev_list = nla_nest_start(reply, NBD_ATTR_DEVICE_LIST);
+       if (!dev_list)
+               goto out;
+
        if (index == -1) {
                ret = idr_for_each(&nbd_index_idr, &status_cb, reply);
                if (ret) {
-- 
2.5.0


------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot
_______________________________________________
Nbd-general mailing list
Nbd-general@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/nbd-general

Reply via email to