[PATCH 1/2] show_pseudo(): protect against NULL ->sym

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

 



When displaying a PSEUDO_SYM, the corresponding symbol is
dereferenced but it's possible that this symbol is NULL
when a type error is present.

Fix this by explicitly checking against null ->sym and
emitting "<bad symbol>" if null.

Signed-off-by: Luc Van Oostenryck <luc.vanoostenryck@xxxxxxxxx>
---
 linearize.c | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/linearize.c b/linearize.c
index 3b4b0d9b4..c174d631f 100644
--- a/linearize.c
+++ b/linearize.c
@@ -111,6 +111,10 @@ const char *show_pseudo(pseudo_t pseudo)
 		struct symbol *sym = pseudo->sym;
 		struct expression *expr;
 
+		if (!sym) {
+			snprintf(buf, 64, "<bad symbol>");
+			break;
+		}
 		if (sym->bb_target) {
 			snprintf(buf, 64, ".L%u", sym->bb_target->nr);
 			break;
-- 
2.16.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