[PATCH 03/13] protect add_convert_to_bool() against bad types / invalid expressions

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

 



It's not possible to do a boolean conversion of an expression
if this expression is invalid / has not type / is VOID.

Fix this by returning VOID in these situations.

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

diff --git a/linearize.c b/linearize.c
index 016b853b9..7aa7fd4c3 100644
--- a/linearize.c
+++ b/linearize.c
@@ -1376,6 +1376,8 @@ static inline pseudo_t add_convert_to_bool(struct entrypoint *ep, pseudo_t src,
 	pseudo_t zero;
 	int op;
 
+	if (!type || src == VOID)
+		return VOID;
 	if (is_bool_type(type))
 		return src;
 	if (is_float_type(type)) {
-- 
2.18.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