From: Youling Tang <[email protected]>

When the kernel command line contains multiple 'crashkernel' parameters
(e.g., `crashkernel=1G,high crashkernel=256M,low`), the original
`remove_parameter()` function only removed the first instance. This
left residual parameters that caused conflicts during kexec operations.

Signed-off-by: Youling Tang <[email protected]>
---
 kexec/kexec.c | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/kexec/kexec.c b/kexec/kexec.c
index 6bf12d7..c9e4bcb 100644
--- a/kexec/kexec.c
+++ b/kexec/kexec.c
@@ -1153,6 +1153,7 @@ void remove_parameter(char *line, const char *param_name)
        if (!start)
                return;
 
+again:
        /*
         * check if that's really the start of a parameter and not in
         * the middle of the word
@@ -1167,6 +1168,11 @@ void remove_parameter(char *line, const char *param_name)
                memmove(start, end+1, strlen(end));
                *(end + strlen(end)) = 0;
        }
+
+       /* There may be multiple 'crashkernel' parameters, such as low and high 
*/
+       start = strstr(line, param_name);
+       if (start)
+               goto again;
 }
 
 static ssize_t _read(int fd, void *buf, size_t count)
-- 
2.34.1


Reply via email to