summaryrefslogtreecommitdiff
path: root/arch/riscv/kernel/setup.c
diff options
context:
space:
mode:
authorGreg Kroah-Hartman <gregkh@linuxfoundation.org>2021-03-22 08:58:02 +0100
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2021-03-22 08:58:02 +0100
commitf85142af36415cdd5be59eb4b00a231c8b6dcb49 (patch)
treee8cfcd3cab515f9c11775eefc1371cef2b88c81d /arch/riscv/kernel/setup.c
parente00943e916782ae17ca05d654779a84f09481ab8 (diff)
parent0d02ec6b3136c73c09e7859f0d0e4e2c4c07b49b (diff)
downloadlwn-f85142af36415cdd5be59eb4b00a231c8b6dcb49.tar.gz
lwn-f85142af36415cdd5be59eb4b00a231c8b6dcb49.zip
Merge 5.12-rc4 into usb-next
We need the usb/thunderbolt fixes in here as well. Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'arch/riscv/kernel/setup.c')
-rw-r--r--arch/riscv/kernel/setup.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/arch/riscv/kernel/setup.c b/arch/riscv/kernel/setup.c
index e85bacff1b50..f8f15332caa2 100644
--- a/arch/riscv/kernel/setup.c
+++ b/arch/riscv/kernel/setup.c
@@ -147,7 +147,8 @@ static void __init init_resources(void)
bss_res.end = __pa_symbol(__bss_stop) - 1;
bss_res.flags = IORESOURCE_SYSTEM_RAM | IORESOURCE_BUSY;
- mem_res_sz = (memblock.memory.cnt + memblock.reserved.cnt) * sizeof(*mem_res);
+ /* + 1 as memblock_alloc() might increase memblock.reserved.cnt */
+ mem_res_sz = (memblock.memory.cnt + memblock.reserved.cnt + 1) * sizeof(*mem_res);
mem_res = memblock_alloc(mem_res_sz, SMP_CACHE_BYTES);
if (!mem_res)
panic("%s: Failed to allocate %zu bytes\n", __func__, mem_res_sz);