From 72f8d48e91a2c28a2ebf1e0196032d988c1673f9 Mon Sep 17 00:00:00 2001 From: Dan Carpenter Date: Mon, 26 Nov 2012 11:22:11 +0300 Subject: [PATCH] math: ignore fuzzy maxes that are type_min() + 1 If you have a loop where: if (x > var) { ... If "var" is unknown then we know that on the true side x is at least 1 higher than the absolute minimum. But it doesn't mean we should count that as a fuzzy max. Signed-off-by: Dan Carpenter --- smatch_math.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/smatch_math.c b/smatch_math.c index fe76e965..a29069ea 100644 --- a/smatch_math.c +++ b/smatch_math.c @@ -497,6 +497,8 @@ static int get_fuzzy_max_helper(struct expression *expr, sval_t *max) if (sval_is_min(sval)) return 0; + if (sval.value == sval_type_min(sval.type).value + 1) /* it's common to be on off */ + return 0; *max = sval_cast(get_type(expr), sval); return 1; -- 2.11.4.GIT