[Pdbg] [PATCH] probe: Validate target class

Vasant Hegde hegdevasant at linux.vnet.ibm.com
Fri Jul 6 00:40:57 AEST 2018


Make sure target class is not NULL before comparision.

Signed-off-by: Vasant Hegde <hegdevasant at linux.vnet.ibm.com>
---
Note that this fixes Segfault issue. But I'm not sure why we endedup
having target->class = NULL. We may have real bug somehwere else in
the code.

-Vasant

 src/main.c | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/src/main.c b/src/main.c
index f89db2f..4c6b7fb 100644
--- a/src/main.c
+++ b/src/main.c
@@ -648,6 +648,10 @@ void print_target(struct pdbg_target *target, int level)
 
 	if (target) {
 		char c = 0;
+
+		if (!pdbg_target_class_name(target))
+			return;
+
 		if (!strcmp(pdbg_target_class_name(target), "pib"))
 			c = 'p';
 		else if (!strcmp(pdbg_target_class_name(target), "core"))
-- 
2.14.3



More information about the Pdbg mailing list