Skip to content

Commit

Permalink
get_user_overflow: simplify a couple conditions
Browse files Browse the repository at this point in the history
The get_absolute_min/max() functions can't fail so they don't need to be
checked.

Signed-off-by: Dan Carpenter <[email protected]>
  • Loading branch information
Dan Carpenter committed Oct 8, 2019
1 parent dcab550 commit ca2f41e
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions check_get_user_overflow.c
Original file line number Diff line number Diff line change
Expand Up @@ -127,14 +127,15 @@ static void check_expr(struct expression *expr)

sm = get_sm_state_expr(my_max_id, expr);
if (sm && slist_has_state(sm->possible, &user_data)) {
if (!get_absolute_max(expr, &max) || sval_cmp_val(max, 20000) > 0)
get_absolute_max(expr, &max);
if (sval_cmp_val(max, 20000) > 0)
overflow = 1;
}

sm = get_sm_state_expr(my_min_id, expr);
if (sm && slist_has_state(sm->possible, &user_data)) {
if (!get_absolute_min(expr, &sval) ||
(sval_is_negative(sval) && sval_cmp_val(sval, -20000) < 0))
get_absolute_min(expr, &sval);
if (sval_is_negative(sval) && sval_cmp_val(sval, -20000) < 0)
underflow = 1;
}

Expand Down

0 comments on commit ca2f41e

Please sign in to comment.