crash_notes should be checked with NULL, not its percpu
member, which can not be NULL

Signed-off-by: Li RongQing <[email protected]>
---
 kernel/kexec_core.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/kernel/kexec_core.c b/kernel/kexec_core.c
index d7140447be75..8c0d6feb76d5 100644
--- a/kernel/kexec_core.c
+++ b/kernel/kexec_core.c
@@ -1067,9 +1067,9 @@ void crash_save_cpu(struct pt_regs *regs, int cpu)
         * squirrelled away.  ELF notes happen to provide
         * all of that, so there is no need to invent something new.
         */
-       buf = (u32 *)per_cpu_ptr(crash_notes, cpu);
-       if (!buf)
+       if (!crash_notes)
                return;
+       buf = (u32 *)per_cpu_ptr(crash_notes, cpu);
        memset(&prstatus, 0, sizeof(prstatus));
        prstatus.pr_pid = current->pid;
        elf_core_copy_kernel_regs(&prstatus.pr_reg, regs);
-- 
2.16.2


_______________________________________________
kexec mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/kexec

Reply via email to