Print this page
12724 update smatch to 0.6.1-rc1-il-5


  77         }
  78         if (!expr)
  79                 return 0;
  80 
  81         type = get_type(expr);
  82         if (is_ptr_type(type))
  83                 return 0;
  84         if (type == &bool_ctype)
  85                 return 0;
  86         if (type_bits(type) >= 0 && type_bits(type) <= 2)
  87                 return 0;
  88 
  89         if (get_hard_max(expr, &dummy))
  90                 return 1;
  91 
  92         if (is_capped_macro(expr))
  93                 return 1;
  94 
  95         if (expr->type == EXPR_BINOP) {
  96                 struct range_list *left_rl, *right_rl;

  97 
  98                 if (expr->op == '&')
  99                         return 1;
 100                 if (expr->op == SPECIAL_RIGHTSHIFT)



 101                         return 1;
 102                 if (expr->op == '%' && is_capped(expr->right))
 103                         return 1;
 104                 if (!is_capped(expr->left))
 105                         return 0;
 106                 if (expr->op == '/')
 107                         return 1;
 108                 if (!is_capped(expr->right))
 109                         return 0;
 110                 if (expr->op == '*') {
 111                         get_absolute_rl(expr->left, &left_rl);
 112                         get_absolute_rl(expr->right, &right_rl);
 113                         if (sval_is_negative(rl_min(left_rl)) ||
 114                             sval_is_negative(rl_min(right_rl)))
 115                                 return 0;
 116                 }
 117                 return 1;
 118         }
 119         if (get_state_expr(my_id, expr) == &capped)
 120                 return 1;
 121         return 0;
 122 }
 123 




  77         }
  78         if (!expr)
  79                 return 0;
  80 
  81         type = get_type(expr);
  82         if (is_ptr_type(type))
  83                 return 0;
  84         if (type == &bool_ctype)
  85                 return 0;
  86         if (type_bits(type) >= 0 && type_bits(type) <= 2)
  87                 return 0;
  88 
  89         if (get_hard_max(expr, &dummy))
  90                 return 1;
  91 
  92         if (is_capped_macro(expr))
  93                 return 1;
  94 
  95         if (expr->type == EXPR_BINOP) {
  96                 struct range_list *left_rl, *right_rl;
  97                 sval_t sval;
  98 
  99                 if (expr->op == '&' && !get_value(expr->right, &sval))
 100                         return 1;
 101                 if (expr->op == SPECIAL_RIGHTSHIFT)
 102                         return 0;
 103                 if (expr->op == '%' &&
 104                     !get_value(expr->right, &sval) && is_capped(expr->right))
 105                         return 1;


 106                 if (!is_capped(expr->left))
 107                         return 0;
 108                 if (expr->op == '/')
 109                         return 1;
 110                 if (!is_capped(expr->right))
 111                         return 0;
 112                 if (expr->op == '*') {
 113                         get_absolute_rl(expr->left, &left_rl);
 114                         get_absolute_rl(expr->right, &right_rl);
 115                         if (sval_is_negative(rl_min(left_rl)) ||
 116                             sval_is_negative(rl_min(right_rl)))
 117                                 return 0;
 118                 }
 119                 return 1;
 120         }
 121         if (get_state_expr(my_id, expr) == &capped)
 122                 return 1;
 123         return 0;
 124 }
 125