[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20250811082510.4154080-2-rppt@kernel.org>
Date: Mon, 11 Aug 2025 11:25:08 +0300
From: Mike Rapoport <rppt@...nel.org>
To: Andrew Morton <akpm@...ux-foundation.org>
Cc: Alexander Graf <graf@...zon.com>,
Baoquan He <bhe@...hat.com>,
Changyuan Lyu <changyuanl@...gle.com>,
Mike Rapoport <rppt@...nel.org>,
Pasha Tatashin <pasha.tatashin@...een.com>,
Pratyush Yadav <pratyush@...nel.org>,
Shuah Khan <shuah@...nel.org>,
Thomas Weißschuh <linux@...ssschuh.net>,
kexec@...ts.infradead.org,
linux-kernel@...r.kernel.org,
linux-kselftest@...r.kernel.org,
linux-mm@...ck.org
Subject: [PATCH 1/3] kho: allow scratch areas with zero size
From: "Mike Rapoport (Microsoft)" <rppt@...nel.org>
Parsing of kho_scratch parameter treats zero size as an invalid value,
although it should be fine for user to request zero sized scratch area
for some types if scratch memory, when for example there is no need to
create scratch area in the low memory.
Treat zero as a valid value for a scratch area size but reject
kho_scratch parameter that defines no scratch memory at all.
Signed-off-by: Mike Rapoport (Microsoft) <rppt@...nel.org>
---
kernel/kexec_handover.c | 7 ++++++-
1 file changed, 6 insertions(+), 1 deletion(-)
diff --git a/kernel/kexec_handover.c b/kernel/kexec_handover.c
index e49743ae52c5..c6ac5a5e51cb 100644
--- a/kernel/kexec_handover.c
+++ b/kernel/kexec_handover.c
@@ -385,6 +385,7 @@ static int __init kho_parse_scratch_size(char *p)
{
size_t len;
unsigned long sizes[3];
+ size_t total_size = 0;
int i;
if (!p)
@@ -421,11 +422,15 @@ static int __init kho_parse_scratch_size(char *p)
}
sizes[i] = memparse(p, &endp);
- if (!sizes[i] || endp == p)
+ if (endp == p)
return -EINVAL;
p = endp;
+ total_size += sizes[i];
}
+ if (!total_size)
+ return -EINVAL;
+
scratch_size_lowmem = sizes[0];
scratch_size_global = sizes[1];
scratch_size_pernode = sizes[2];
--
2.47.2
Powered by blists - more mailing lists