aboutsummaryrefslogtreecommitdiffstats
path: root/drivers
diff options
context:
space:
mode:
authorAlex Elder <elder@inktank.com>2012-08-02 12:29:44 -0400
committerAlex Elder <elder@inktank.com>2012-10-01 15:30:48 -0400
commit0f1d3f938527f319d830ef3082c218c77cfd159f (patch)
tree8edf8b4aebfb073d538c773517789f0f6bfcb065 /drivers
parent3593815022998ab75379f64735ff67b3ea388cbe (diff)
rbd: make snap_names_len a u64
The snap_names_len field of an rbd_image_header structure is defined with type size_t. That field is used as both the source and target of 64-bit byte-order swapping operations though, so it's best to define it with type u64 instead. Signed-off-by: Alex Elder <elder@inktank.com> Reviewed-by: Josh Durgin <josh.durgin@inktank.com>
Diffstat (limited to 'drivers')
-rw-r--r--drivers/block/rbd.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/drivers/block/rbd.c b/drivers/block/rbd.c
index bf418a6afbe0..02de524d4b67 100644
--- a/drivers/block/rbd.c
+++ b/drivers/block/rbd.c
@@ -81,7 +81,7 @@ struct rbd_image_header {
81 __u8 crypt_type; 81 __u8 crypt_type;
82 __u8 comp_type; 82 __u8 comp_type;
83 struct ceph_snap_context *snapc; 83 struct ceph_snap_context *snapc;
84 size_t snap_names_len; 84 u64 snap_names_len;
85 u32 total_snaps; 85 u32 total_snaps;
86 86
87 char *snap_names; 87 char *snap_names;
@@ -510,6 +510,7 @@ static int rbd_header_from_disk(struct rbd_image_header *header,
510 510
511 if (snap_count) { 511 if (snap_count) {
512 header->snap_names_len = le64_to_cpu(ondisk->snap_names_len); 512 header->snap_names_len = le64_to_cpu(ondisk->snap_names_len);
513 BUG_ON(header->snap_names_len > (u64) SIZE_MAX);
513 header->snap_names = kmalloc(header->snap_names_len, 514 header->snap_names = kmalloc(header->snap_names_len,
514 GFP_KERNEL); 515 GFP_KERNEL);
515 if (!header->snap_names) 516 if (!header->snap_names)