diff options
author | Josh Durgin <josh.durgin@inktank.com> | 2013-08-28 20:08:10 -0400 |
---|---|---|
committer | Sage Weil <sage@inktank.com> | 2013-09-04 01:08:51 -0400 |
commit | c35455791c1131e7ccbf56ea6fbdd562401c2ce2 (patch) | |
tree | 913c5f5590faa818502c266a033f218573e5cc21 /drivers/block | |
parent | 03507db631c94a48e316c7f638ffb2991544d617 (diff) |
rbd: fix null dereference in dout
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>
Diffstat (limited to 'drivers/block')
-rw-r--r-- | drivers/block/rbd.c | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/drivers/block/rbd.c b/drivers/block/rbd.c index 80f787b6226e..fef3687c1527 100644 --- a/drivers/block/rbd.c +++ b/drivers/block/rbd.c | |||
@@ -3702,12 +3702,14 @@ static int _rbd_dev_v2_snap_size(struct rbd_device *rbd_dev, u64 snap_id, | |||
3702 | if (ret < sizeof (size_buf)) | 3702 | if (ret < sizeof (size_buf)) |
3703 | return -ERANGE; | 3703 | return -ERANGE; |
3704 | 3704 | ||
3705 | if (order) | 3705 | if (order) { |
3706 | *order = size_buf.order; | 3706 | *order = size_buf.order; |
3707 | dout(" order %u", (unsigned int)*order); | ||
3708 | } | ||
3707 | *snap_size = le64_to_cpu(size_buf.size); | 3709 | *snap_size = le64_to_cpu(size_buf.size); |
3708 | 3710 | ||
3709 | dout(" snap_id 0x%016llx order = %u, snap_size = %llu\n", | 3711 | dout(" snap_id 0x%016llx snap_size = %llu\n", |
3710 | (unsigned long long)snap_id, (unsigned int)*order, | 3712 | (unsigned long long)snap_id, |
3711 | (unsigned long long)*snap_size); | 3713 | (unsigned long long)*snap_size); |
3712 | 3714 | ||
3713 | return 0; | 3715 | return 0; |