projects
/
GitHub
/
moto-9609
/
android_kernel_motorola_exynos9610.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(parent:
6448669
)
ceph: fix overflow check in build_snap_context()
author
Xi Wang
<xi.wang@gmail.com>
Thu, 16 Feb 2012 16:56:29 +0000
(11:56 -0500)
committer
Alex Elder
<elder@dreamhost.com>
Thu, 22 Mar 2012 15:47:45 +0000
(10:47 -0500)
The overflow check for a + n * b should be (n > (ULONG_MAX - a) / b),
rather than (n > ULONG_MAX / b - a).
Signed-off-by: Xi Wang <xi.wang@gmail.com>
Signed-off-by: Sage Weil <sage@newdream.net>
fs/ceph/snap.c
patch
|
blob
|
blame
|
history
diff --git
a/fs/ceph/snap.c
b/fs/ceph/snap.c
index a559c80f127a04353a488181029744a009165f09..f04c0961f9937eb6f553978f10942800818528ba 100644
(file)
--- a/
fs/ceph/snap.c
+++ b/
fs/ceph/snap.c
@@
-331,7
+331,7
@@
static int build_snap_context(struct ceph_snap_realm *realm)
/* alloc new snap context */
err = -ENOMEM;
- if (num >
ULONG_MAX / sizeof(u64) - sizeof(*snapc
))
+ if (num >
(ULONG_MAX - sizeof(*snapc)) / sizeof(u64
))
goto fail;
snapc = kzalloc(sizeof(*snapc) + num*sizeof(u64), GFP_NOFS);
if (!snapc)