diff options
author | Rickard Strandqvist <rickard_strandqvist@spectrumdigital.se> | 2014-05-22 18:03:16 -0400 |
---|---|---|
committer | Benjamin Herrenschmidt <benh@kernel.crashing.org> | 2014-05-27 23:35:39 -0400 |
commit | b717d98543d90c50f398ddfe9665483d09adca7a (patch) | |
tree | b39617222f9507721d006195b3919e76f8b97294 /arch/powerpc | |
parent | 4750afa2c56821c9184c4d1b6606c3c459ca73de (diff) |
arch: powerpc/fadump: Cleaning up inconsistent NULL checks
Cleaning up inconsistent NULL checks.
There is otherwise a risk of a possible null pointer dereference.
Was largely found by using a static code analysis program called cppcheck.
Signed-off-by: Rickard Strandqvist <rickard_strandqvist@spectrumdigital.se>
Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
Diffstat (limited to 'arch/powerpc')
-rw-r--r-- | arch/powerpc/kernel/fadump.c | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/arch/powerpc/kernel/fadump.c b/arch/powerpc/kernel/fadump.c index 02667744fbb5..d55e8986730a 100644 --- a/arch/powerpc/kernel/fadump.c +++ b/arch/powerpc/kernel/fadump.c | |||
@@ -646,7 +646,7 @@ static int __init fadump_build_cpu_notes(const struct fadump_mem_struct *fdm) | |||
646 | } | 646 | } |
647 | /* Lower 4 bytes of reg_value contains logical cpu id */ | 647 | /* Lower 4 bytes of reg_value contains logical cpu id */ |
648 | cpu = reg_entry->reg_value & FADUMP_CPU_ID_MASK; | 648 | cpu = reg_entry->reg_value & FADUMP_CPU_ID_MASK; |
649 | if (!cpumask_test_cpu(cpu, &fdh->cpu_online_mask)) { | 649 | if (fdh && !cpumask_test_cpu(cpu, &fdh->cpu_online_mask)) { |
650 | SKIP_TO_NEXT_CPU(reg_entry); | 650 | SKIP_TO_NEXT_CPU(reg_entry); |
651 | continue; | 651 | continue; |
652 | } | 652 | } |
@@ -663,9 +663,11 @@ static int __init fadump_build_cpu_notes(const struct fadump_mem_struct *fdm) | |||
663 | } | 663 | } |
664 | fadump_final_note(note_buf); | 664 | fadump_final_note(note_buf); |
665 | 665 | ||
666 | pr_debug("Updating elfcore header (%llx) with cpu notes\n", | 666 | if (fdh) { |
667 | pr_debug("Updating elfcore header (%llx) with cpu notes\n", | ||
667 | fdh->elfcorehdr_addr); | 668 | fdh->elfcorehdr_addr); |
668 | fadump_update_elfcore_header((char *)__va(fdh->elfcorehdr_addr)); | 669 | fadump_update_elfcore_header((char *)__va(fdh->elfcorehdr_addr)); |
670 | } | ||
669 | return 0; | 671 | return 0; |
670 | 672 | ||
671 | error_out: | 673 | error_out: |