[Crash-utility] [PATCH 1/2] mips: fix missing note check

Rabin Vincent rabin.vincent at axis.com
Sun Dec 4 14:03:53 UTC 2016


From: Rabin Vincent <rabinv at axis.com>

Add a missing continue after we check if note is NULL.  Otherwise we
proceed and dereference the NULL pointer and segfault after printing the
"cannot find NT_PRSTATUS note for cpu" warning.
---
 mips.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/mips.c b/mips.c
index 5f74b7c..30e6255 100644
--- a/mips.c
+++ b/mips.c
@@ -939,9 +939,11 @@ static int mips_get_elf_notes(void)
 		else if (KDUMP_DUMPFILE())
 			note = netdump_get_prstatus_percpu(i);
 
-		if (!note)
+		if (!note) {
 			error(WARNING,
 			      "cannot find NT_PRSTATUS note for cpu: %d\n", i);
+			continue;
+		}
 
 		len = sizeof(Elf32_Nhdr);
 		len = roundup(len + note->n_namesz, 4);
-- 
2.1.4




More information about the Crash-utility mailing list