diff options
Diffstat (limited to 'kernel/kexec.c')
-rw-r--r-- | kernel/kexec.c | 9 |
1 files changed, 4 insertions, 5 deletions
diff --git a/kernel/kexec.c b/kernel/kexec.c index 60bf181..7b08867 100644 --- a/kernel/kexec.c +++ b/kernel/kexec.c @@ -1129,6 +1129,7 @@ int crash_shrink_memory(unsigned long new_size) { int ret = 0; unsigned long start, end; + unsigned long old_size; struct resource *ram_res; mutex_lock(&kexec_mutex); @@ -1139,11 +1140,9 @@ int crash_shrink_memory(unsigned long new_size) } start = crashk_res.start; end = crashk_res.end; - - if (new_size >= end - start + 1) { - ret = -EINVAL; - if (new_size == end - start + 1) - ret = 0; + old_size = (end == 0) ? 0 : end - start + 1; + if (new_size >= old_size) { + ret = (new_size == old_size) ? 0 : -EINVAL; goto unlock; } |