Linux SPARSE checker discussions
 help / color / mirror / Atom feed
* [PATCH] avoid crash with test-linearize -vv
@ 2017-03-19 18:01 Luc Van Oostenryck
  2017-03-24  3:03 ` Christopher Li
  0 siblings, 1 reply; 3+ messages in thread
From: Luc Van Oostenryck @ 2017-03-19 18:01 UTC (permalink / raw)
  To: linux-sparse; +Cc: Christopher Li, Dibyendu Majumdar, Luc Van Oostenryck

When verbose is set to 2 or higher, show_instruction()
also display removed instructions. Some of these instructions
can have their associated symbol removed and set to NULL
which will cause a crash with 'test-linearize -vv'.

Fix this by avoiding to dereference symbol's details of
removed instructions.
---
 linearize.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/linearize.c b/linearize.c
index 4ebd6d6d8..1bbada887 100644
--- a/linearize.c
+++ b/linearize.c
@@ -319,6 +319,8 @@ const char *show_instruction(struct instruction *insn)
 		struct symbol *sym = insn->symbol->sym;
 		buf += sprintf(buf, "%s <- ", show_pseudo(insn->target));
 
+		if (!insn->bb && !sym)
+			break;
 		if (sym->bb_target) {
 			buf += sprintf(buf, ".L%u", sym->bb_target->nr);
 			break;
-- 
2.12.0


^ permalink raw reply related	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2017-03-24  7:49 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2017-03-19 18:01 [PATCH] avoid crash with test-linearize -vv Luc Van Oostenryck
2017-03-24  3:03 ` Christopher Li
2017-03-24  7:49   ` Luc Van Oostenryck

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox