memblock: ensure there is no overflow in memblock_overlaps_region()
authorMike Rapoport <rppt@linux.ibm.com>
Wed, 30 Jun 2021 06:12:13 +0000 (09:12 +0300)
committerMike Rapoport <rppt@linux.ibm.com>
Wed, 30 Jun 2021 08:38:56 +0000 (11:38 +0300)
commit023accf5cdc1e504a9b04187ec23ff156fe53d90
tree4bd82ea2aa7444345e9d13a3eec68267cc9da07f
parentf921f53e089a12a192808ac4319f28727b35dc0f
memblock: ensure there is no overflow in memblock_overlaps_region()

There maybe an overflow in memblock_overlaps_region() if it is called with
base and size such that

base + size > PHYS_ADDR_MAX

Make sure that memblock_overlaps_region() caps the size to prevent such
overflow and remove now duplicated call to memblock_cap_size() from
memblock_is_region_reserved().

Signed-off-by: Mike Rapoport <rppt@linux.ibm.com>
Tested-by: Tony Lindgren <tony@atomide.com>
mm/memblock.c