rbd: fix null dereference in dout
authorJosh Durgin <josh.durgin@inktank.com>
Thu, 29 Aug 2013 00:08:10 +0000 (17:08 -0700)
committerSage Weil <sage@inktank.com>
Wed, 4 Sep 2013 05:08:51 +0000 (22:08 -0700)
The order parameter is sometimes NULL in _rbd_dev_v2_snap_size(), but
the dout() always derefences it. Move this to another dout() protected
by a check that order is non-NULL.

Signed-off-by: Josh Durgin <josh.durgin@inktank.com>
Reviewed-by: Sage Weil <sage@inktank.com>
Reviewed-by: Alex Elder <alex.elder@linaro.org>
drivers/block/rbd.c

index 80f787b6226ecb449212bfb1d5b06ef6013a2057..fef3687c1527767aa37bc57a56af1756b54dd79e 100644 (file)
@@ -3702,12 +3702,14 @@ static int _rbd_dev_v2_snap_size(struct rbd_device *rbd_dev, u64 snap_id,
        if (ret < sizeof (size_buf))
                return -ERANGE;
 
-       if (order)
+       if (order) {
                *order = size_buf.order;
+               dout("  order %u", (unsigned int)*order);
+       }
        *snap_size = le64_to_cpu(size_buf.size);
 
-       dout("  snap_id 0x%016llx order = %u, snap_size = %llu\n",
-               (unsigned long long)snap_id, (unsigned int)*order,
+       dout("  snap_id 0x%016llx snap_size = %llu\n",
+               (unsigned long long)snap_id,
                (unsigned long long)*snap_size);
 
        return 0;