ret might be uninitialized and is returned that way when kstrdup of
rbd_dev->spec->snap_name fails. Fix it by returning ENOMEM from that
place.

Signed-off-by: Jiri Slaby <jsl...@suse.cz>
---
 drivers/block/rbd.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/drivers/block/rbd.c b/drivers/block/rbd.c
index 6b2b039..3417f34 100644
--- a/drivers/block/rbd.c
+++ b/drivers/block/rbd.c
@@ -3113,8 +3113,10 @@ static int rbd_dev_probe_update_spec(struct rbd_device 
*rbd_dev)
                goto out_err;
        }
        rbd_dev->spec->snap_name = kstrdup(name, GFP_KERNEL);
-       if(!rbd_dev->spec->snap_name)
+       if(!rbd_dev->spec->snap_name) {
+               ret = -ENOMEM;
                goto out_err;
+       }
 
        return 0;
 out_err:
-- 
1.8.2


--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Reply via email to