]> git.karo-electronics.de Git - karo-tx-linux.git/blobdiff - net/ceph/osdmap.c
Merge branch 'x86-cleanups-for-linus' of git://git.kernel.org/pub/scm/linux/kernel...
[karo-tx-linux.git] / net / ceph / osdmap.c
index fd863fe76934afb33bbee5583d68028366f23b91..29ad46ec9dcfc1d6de7c680c9555c00f5ac6546e 100644 (file)
@@ -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) +