summaryrefslogtreecommitdiff
path: root/net/ceph/osdmap.c
diff options
context:
space:
mode:
authorIlya Dryomov <ilya.dryomov@inktank.com>2014-03-13 16:36:14 +0200
committerSage Weil <sage@inktank.com>2014-04-04 21:07:40 -0700
commit3977058c468b872c6bc5e5273bf911d791848643 (patch)
tree8d4d2f0c3e204724cad1295ac88ecb2e3d930a85 /net/ceph/osdmap.c
parent597b52f6ca247086371abd67e5083292a500e736 (diff)
libceph: safely decode max_osd value in osdmap_decode()
max_osd value is not covered by any ceph_decode_need(). Use a safe version of ceph_decode_* macro to decode it. Signed-off-by: Ilya Dryomov <ilya.dryomov@inktank.com> Reviewed-by: Alex Elder <elder@linaro.org>
Diffstat (limited to 'net/ceph/osdmap.c')
-rw-r--r--net/ceph/osdmap.c6
1 files changed, 4 insertions, 2 deletions
diff --git a/net/ceph/osdmap.c b/net/ceph/osdmap.c
index 298d076eee89..ec06010657b3 100644
--- a/net/ceph/osdmap.c
+++ b/net/ceph/osdmap.c
@@ -687,9 +687,10 @@ static int osdmap_set_max_osd(struct ceph_osdmap *map, int max)
static int osdmap_decode(void **p, void *end, struct ceph_osdmap *map)
{
u16 version;
- u32 len, max, i;
u32 epoch = 0;
void *start = *p;
+ u32 max;
+ u32 len, i;
int err;
struct ceph_pg_pool_info *pi;
@@ -736,7 +737,8 @@ static int osdmap_decode(void **p, void *end, struct ceph_osdmap *map)
ceph_decode_32_safe(p, end, map->flags, e_inval);
- max = ceph_decode_32(p);
+ /* max_osd */
+ ceph_decode_32_safe(p, end, max, e_inval);
/* (re)alloc osd arrays */
err = osdmap_set_max_osd(map, max);