[PATCH 2/2] fix crash on bad expression in linearize_switch()

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

 



If the expression for the condition is dereferenced
for its type even if it is NULL.

Fix this by returning early if the expression linearize to NULL.

Signed-off-by: Luc Van Oostenryck <luc.vanoostenryck@xxxxxxxxx>
---
 linearize.c             | 2 ++
 validation/empty-expr.c | 1 -
 2 files changed, 2 insertions(+), 1 deletion(-)

diff --git a/linearize.c b/linearize.c
index 2e146de7a..deed3ca2f 100644
--- a/linearize.c
+++ b/linearize.c
@@ -1945,6 +1945,8 @@ static pseudo_t linearize_switch(struct entrypoint *ep, struct statement *stmt)
 	pseudo_t pseudo;
 
 	pseudo = linearize_expression(ep, expr);
+	if (pseudo == VOID)
+		return pseudo;
 
 	active = ep->active;
 	if (!bb_reachable(active))
diff --git a/validation/empty-expr.c b/validation/empty-expr.c
index 506cfba7e..61decf737 100644
--- a/validation/empty-expr.c
+++ b/validation/empty-expr.c
@@ -18,7 +18,6 @@ static int bar(void)
 
 /*
  * check-name: empty expression
- * check-known-to-fail
  *
  * check-error-start
 empty-expr.c:3:17: error: an expression is expected before ')'
-- 
2.15.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