Home
last modified time | relevance | path

Searched hist:"34 fe653716b0d340bc26dd4823d2dbe00c57f849" (Results 1 – 1 of 1) sorted by relevance

/openbmc/linux/mm/
H A Dvmalloc.cdiff 34fe653716b0d340bc26dd4823d2dbe00c57f849 Mon Dec 14 21:08:43 CST 2020 Andrew Morton <akpm@linux-foundation.org> mm/vmalloc.c:__vmalloc_area_node(): avoid 32-bit overflow

With a machine with 3 TB (more than 2 TB memory). If you use vmalloc to
allocate > 2 TB memory, the array_size below will be overflowed.

The array_size is an unsigned int and can only be used to allocate less
than 2 TB memory. If you pass 2*1028*1028*1024*1024 = 2 * 2^40 in the
argument of vmalloc. The array_size will become 2*2^31 = 2^32. The 2^32
cannot be store with a 32 bit integer.

The fix is to change the type of array_size to unsigned long.

[akpm@linux-foundation.org: rework for current mainline]

Link: https://bugzilla.kernel.org/show_bug.cgi?id=210023
Reported-by: <hsinhuiwu@gmail.com>
Cc: Matthew Wilcox <willy@infradead.org>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>