X-Git-Url: https://git.karo-electronics.de/?a=blobdiff_plain;f=net%2Fceph%2Fosdmap.c;h=29ad46ec9dcfc1d6de7c680c9555c00f5ac6546e;hb=eb05df9e7e793f3134dbb574c7ccc05f7932bc59;hp=fd863fe76934afb33bbee5583d68028366f23b91;hpb=c63c4edcc8cf0f1ed2c6a1c9ba7a56bc50aa8199;p=karo-tx-linux.git diff --git a/net/ceph/osdmap.c b/net/ceph/osdmap.c index fd863fe76934..29ad46ec9dcf 100644 --- a/net/ceph/osdmap.c +++ b/net/ceph/osdmap.c @@ -283,7 +283,8 @@ static struct crush_map *crush_decode(void *pbyval, void *end) ceph_decode_32_safe(p, end, yes, bad); #if BITS_PER_LONG == 32 err = -EINVAL; - if (yes > ULONG_MAX / sizeof(struct crush_rule_step)) + if (yes > (ULONG_MAX - sizeof(*r)) + / sizeof(struct crush_rule_step)) goto bad; #endif r = c->rules[i] = kmalloc(sizeof(*r) +