lkml.org 
[lkml]   [2012]   [Apr]   [25]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
    Patch in this message
    /
    Date
    Subject[BUG]memblock: fix overflow of array index
    From
    Fixing the mismatch in signed and unsigned type assignment, which
    potentially can lead to integer overflow bug.

    Thanks.

    Reviewed-by: Minchan Kim <minchan@kernel.org>
    Signed-off-by: Peter Teoh <htmldeveloper@gmail.com>

    diff --git a/mm/memblock.c b/mm/memblock.c
    index a44eab3..2c621c5 100644
    --- a/mm/memblock.c
    +++ b/mm/memblock.c
    @@ -553,8 +553,8 @@ void __init_memblock __next_free_mem_range(u64
    *idx, int nid,
    {
    struct memblock_type *mem = &memblock.memory;
    struct memblock_type *rsv = &memblock.reserved;
    - int mi = *idx & 0xffffffff;
    - int ri = *idx >> 32;
    + unsigned int mi = *idx & 0xffffffff;
    + unsigned int ri = *idx >> 32;

    for ( ; mi < mem->cnt; mi++) {
    struct memblock_region *m = &mem->regions[mi];


    --
    Regards,
    Peter Teoh


    \
     
     \ /
      Last update: 2012-04-25 10:33    [W:0.037 / U:32.440 seconds]
    ©2003-2016 Jasper Spaans. hosted at Digital OceanAdvertise on this site