From: Alex Elder <elder@inktank.com>
To: "ceph-devel@vger.kernel.org" <ceph-devel@vger.kernel.org>
Subject: [PATCH 1/3] rbd: make snap_names_len a u64
Date: Mon, 06 Aug 2012 11:03:31 -0700 [thread overview]
Message-ID: <502006F3.5030609@inktank.com> (raw)
In-Reply-To: <50200691.3040006@inktank.com>
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>
---
drivers/block/rbd.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
Index: b/drivers/block/rbd.c
===================================================================
--- a/drivers/block/rbd.c
+++ b/drivers/block/rbd.c
@@ -81,7 +81,7 @@ struct rbd_image_header {
__u8 crypt_type;
__u8 comp_type;
struct ceph_snap_context *snapc;
- size_t snap_names_len;
+ u64 snap_names_len;
u32 total_snaps;
char *snap_names;
@@ -511,6 +511,7 @@ static int rbd_header_from_disk(struct r
if (snap_count) {
header->snap_names_len = le64_to_cpu(ondisk->snap_names_len);
+ BUG_ON(header->snap_names_len > (u64) SIZE_MAX);
header->snap_names = kmalloc(header->snap_names_len,
GFP_KERNEL);
if (!header->snap_names)
next prev parent reply other threads:[~2012-08-06 18:03 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-08-06 18:01 [PATCH 0/3] rbd: a few small cleanups Alex Elder
2012-08-06 18:03 ` Alex Elder [this message]
2012-08-06 18:03 ` [PATCH 2/3] rbd: ensure invalid pointers are made null Alex Elder
2012-08-06 18:03 ` [PATCH 3/3] rbd: use sizeof (object) instead of sizeof (type) Alex Elder
2012-08-07 23:28 ` [PATCH 0/3] rbd: a few small cleanups Josh Durgin
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=502006F3.5030609@inktank.com \
--to=elder@inktank.com \
--cc=ceph-devel@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox