From 3e05fd8057ab52fac2a92bf5aff3b07a040fb21a Mon Sep 17 00:00:00 2001 From: Dan Carpenter Date: Fri, 30 Jan 2015 18:38:17 +0300 Subject: [PATCH] sval: cast the result in sval_binop() If you have "UINT_MAX + 1" then it would say the result ->type was &int_ctype but the ->uvalue would be 0x100000000 which isn't correct. We need to truncate to 32 bits before returning. Signed-off-by: Dan Carpenter --- smatch_sval.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/smatch_sval.c b/smatch_sval.c index db647d19..20428ab5 100644 --- a/smatch_sval.c +++ b/smatch_sval.c @@ -460,7 +460,7 @@ sval_t sval_binop(sval_t left, int op, sval_t right) ret = sval_binop_unsigned(type, left, op, right); else ret = sval_binop_signed(type, left, op, right); - return ret; + return sval_cast(type, ret); } int sval_unop_overflows(sval_t sval, int op) -- 2.11.4.GIT