Message ID | 1395944299-21970-8-git-send-email-ilya.dryomov@inktank.com (mailing list archive) |
---|---|
State | New, archived |
Headers | show |
On 03/27/2014 01:17 PM, Ilya Dryomov wrote: > max_osd value is not covered by any ceph_decode_need(). Use a safe > version of ceph_decode_* macro to decode it. I know it's slightly more efficient, but I never liked those ceph_decode_need() statements that added together a bunch of things you're about to go decode... Anyway, this is the right thing to do. Looks good. Reviewed-by: Alex Elder <elder@linaro.org> > Signed-off-by: Ilya Dryomov <ilya.dryomov@inktank.com> > --- > net/ceph/osdmap.c | 6 ++++-- > 1 file 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); > -- To unsubscribe from this list: send the line "unsubscribe ceph-devel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
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);
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> --- net/ceph/osdmap.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-)