[PATCH] avoid crash with test-linearize -vv

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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

--
To unsubscribe from this list: send the line "unsubscribe linux-sparse" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html



[Index of Archives]     [Newbies FAQ]     [LKML]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Trinity Fuzzer Tool]

  Powered by Linux