rbd: Fix ceph_snap_context size calculation
authorYan, Zheng <zheng.z.yan@intel.com>
Wed, 6 Jun 2012 14:15:33 +0000 (09:15 -0500)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Mon, 26 Nov 2012 19:38:10 +0000 (11:38 -0800)
(cherry picked from commit f9f9a1904467816452fc70740165030e84c2c659)

ceph_snap_context->snaps is an u64 array

Signed-off-by: Zheng Yan <zheng.z.yan@intel.com>
Reviewed-by: Alex Elder <elder@inktank.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/block/rbd.c

index d074ed9..7b33136 100644 (file)
@@ -497,7 +497,7 @@ static int rbd_header_from_disk(struct rbd_image_header *header,
 
        snap_count = le32_to_cpu(ondisk->snap_count);
        header->snapc = kmalloc(sizeof(struct ceph_snap_context) +
-                               snap_count * sizeof (*ondisk),
+                               snap_count * sizeof(u64),
                                gfp_flags);
        if (!header->snapc)
                return -ENOMEM;