Re: [BUG]memblock: fix overflow of array index

From: Peter Teoh
Date: Wed Apr 25 2012 - 20:50:58 EST


Thanks for the reply. Just an educational question: is it possible
to set one-byte per memblock? And what is the minimum memblock
size?

Even if 2G memblock is a huge number, it still seemed like a bug to me
that there is no check on the maximum number (which is 2G) of this
variable (assuming signed int). Software can always purposely push
that number up and the system can panic?

On Thu, Apr 26, 2012 at 6:28 AM, Tejun Heo <tj@xxxxxxxxxx> wrote:
> On Wed, Apr 25, 2012 at 04:30:19PM +0800, Peter Teoh wrote:
>> Fixing the mismatch in signed and unsigned type assignment, which
>> potentially can lead to integer overflow bug.
>>
>> Thanks.
>>
>> Reviewed-by: Minchan Kim <minchan@xxxxxxxxxx>
>> Signed-off-by: Peter Teoh <htmldeveloper@xxxxxxxxx>
>
> All indexes in memblock are integers.  Changing that particular one to
> unsigned int doesn't fix anything.  I think it just makes things more
> confusing.  If there ever are cases w/ more then 2G memblocks, we're
> going for 64bit not unsigned.
>
> Thanks.
>
> --
> tejun



--
Regards,
Peter Teoh
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/