mirror of
https://github.com/BobTheBlinker/android_kernel_motorola_sm6375.git
synced 2026-10-30 19:51:31 -04:00
SLOB: fix bogus ksize calculation
SLOB's ksize calculation was braindamaged and generally harmlessly underreported the allocation size. But for very small buffers, it could in fact overreport them, leading code depending on krealloc to overrun the allocation and trample other data. Signed-off-by: Matt Mackall <[email protected]> Tested-by: Peter Zijlstra <[email protected]> Signed-off-by: Linus Torvalds <[email protected]>
This commit is contained in:
parent
e09e6e2b6a
commit
85ba94ba05
1 changed files with 1 additions and 1 deletions
|
|
@ -515,7 +515,7 @@ size_t ksize(const void *block)
|
|||
|
||||
sp = (struct slob_page *)virt_to_page(block);
|
||||
if (slob_page(sp))
|
||||
return ((slob_t *)block - 1)->units + SLOB_UNIT;
|
||||
return (((slob_t *)block - 1)->units - 1) * SLOB_UNIT;
|
||||
else
|
||||
return sp->page.private;
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue