absolute: fix parameter info counting
authorDan Carpenter <dan.carpenter@oracle.com>
Tue, 23 Oct 2012 08:44:29 +0000 (23 11:44 +0300)
committerDan Carpenter <dan.carpenter@oracle.com>
Tue, 23 Oct 2012 08:44:29 +0000 (23 11:44 +0300)
The counting was being done wrong so it messed up the database.

Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
smatch_absolute.c

index 8030ffb..82fee5f 100644 (file)
@@ -140,15 +140,18 @@ static void match_call_info(struct expression *expr)
 {
        struct expression *arg;
        char *name;
-       int i = 0;
+       int i;
 
        name = get_fnptr_name(expr->fn);
        if (!name)
                return;
 
+       i = -1;
        FOR_EACH_PTR(expr->args, arg) {
                long long min, max;
 
+               i++;
+
                if (!get_absolute_min(arg, &min))
                        continue;
                if (!get_absolute_max(arg, &max))
@@ -160,7 +163,6 @@ static void match_call_info(struct expression *expr)
                sm_msg("info: passes absolute_limits '%s' %d '$$' %s %s",
                       name, i, show_range(min, max),
                       is_static(expr->fn) ? "static" : "global");
-               i++;
        } END_FOR_EACH_PTR(arg);
 
        free_string(name);