[Devel] [PATCH] mm: Fix int overflow in callers of do_shrink_slab()

Cyrill Gorcunov gorcunov at virtuozzo.com
Fri Sep 28 18:18:35 MSK 2018


On Fri, Sep 28, 2018 at 02:33:38PM +0300, Kirill Tkhai wrote:
> do_shrink_slab() returns unsigned long value, and
> the placing into int variable cuts high bytes off.
> Then we compare ret and 0xfffffffe (since SHRINK_EMPTY
> is converted to ret type).
> 
> Thus, big number of objects returned by do_shrink_slab()
> may be interpreted as SHRINK_EMPTY, if low bytes of
> their value are equal to 0xfffffffe. Fix that
> by declaration ret as unsigned long in these functions.
> 
> Reported-by: Cyrill Gorcunov <gorcunov at openvz.org>
> Signed-off-by: Kirill Tkhai <ktkhai at virtuozzo.com>
Acked-by: Cyrill Gorcunov <gorcunov at gmail.com>


More information about the Devel mailing list