aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorZhen Lei <[email protected]>2023-05-27 20:34:35 +0800
committerAndrew Morton <[email protected]>2023-06-09 17:44:23 -0700
commit6f22a744f4ee7a22be4704cf93bbe22decc7e79e (patch)
tree0143ce59beda6527771a1b35113144fc7135d0ad
parent1cba6c4309f03de570202c46f03df3f73a0d4c82 (diff)
kexec: delete a useless check in crash_shrink_memory()
The check '(crashk_res.parent != NULL)' is added by commit e05bd3367bd3 ("kexec: fix Oops in crash_shrink_memory()"), but it's stale now. Because if 'crashk_res' is not reserved, it will be zero in size and will be intercepted by the above 'if (new_size >= old_size)'. Ago: if (new_size >= end - start + 1) Now: old_size = (end == 0) ? 0 : end - start + 1; if (new_size >= old_size) Link: https://lkml.kernel.org/r/[email protected] Signed-off-by: Zhen Lei <[email protected]> Cc: Baoquan He <[email protected]> Cc: Cong Wang <[email protected]> Cc: Eric W. Biederman <[email protected]> Cc: Michael Holzheu <[email protected]> Signed-off-by: Andrew Morton <[email protected]>
-rw-r--r--kernel/kexec_core.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/kernel/kexec_core.c b/kernel/kexec_core.c
index 22acee18195a..d1ab139dd490 100644
--- a/kernel/kexec_core.c
+++ b/kernel/kexec_core.c
@@ -1137,7 +1137,7 @@ int crash_shrink_memory(unsigned long new_size)
end = start + new_size;
crash_free_reserved_phys_range(end, crashk_res.end);
- if ((start == end) && (crashk_res.parent != NULL))
+ if (start == end)
release_resource(&crashk_res);
ram_res->start = end;