From 3fd87b8d909ed9028162d882ca168271517e5b98 Mon Sep 17 00:00:00 2001 From: Dan Carpenter Date: Wed, 3 Feb 2021 14:23:54 +0300 Subject: [PATCH] extra: take a short cut in param_limit_binops The db_param_limit_binops() function tries to say that if we know that the $1 parameter is 0-9 range and we are passing "frob(i * 3);" then that means "i is 0-3". If the param limits "$->foo" then that's not useful for this so we can just return early. Hopefully it's a small speed up. Signed-off-by: Dan Carpenter --- smatch_extra.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/smatch_extra.c b/smatch_extra.c index 1db76bc2..c1d227d7 100644 --- a/smatch_extra.c +++ b/smatch_extra.c @@ -2607,6 +2607,8 @@ static void db_param_limit_binops(struct expression *arg, char *key, struct rang sval_t zero = { .type = rl_type(rl), }; sval_t sval; + if (strcmp(key, "$") != 0) + return; if (arg->op != '*') return; if (!get_implied_value(arg->right, &sval)) -- 2.11.4.GIT