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


1050 
1051 static void match_call_info(struct expression *expr)
1052 {
1053         struct expression *arg;
1054         struct symbol *type;
1055         char *str;
1056         int i;
1057 
1058         i = -1;
1059         FOR_EACH_PTR(expr->args, arg) {
1060                 i++;
1061                 type = get_arg_type(expr->fn, i);
1062                 str = get_user_rl_str(arg, type);
1063                 if (!str)
1064                         continue;
1065 
1066                 sql_insert_caller_info(expr, USER_DATA, i, "$", str);
1067         } END_FOR_EACH_PTR(arg);
1068 }
1069 
1070 static int is_struct_ptr(struct symbol *sym)
1071 {
1072         struct symbol *type;
1073 
1074         if (!sym)
1075                 return 0;
1076         type = get_real_base_type(sym);
1077         if (!type || type->type != SYM_PTR)
1078                 return 0;
1079         type = get_real_base_type(type);
1080         if (!type || type->type != SYM_STRUCT)
1081                 return 0;
1082         return 1;
1083 }
1084 
1085 static void struct_member_callback(struct expression *call, int param, char *printed_name, struct sm_state *sm)
1086 {
1087         struct smatch_state *state;
1088         struct range_list *rl;
1089         struct symbol *type;
1090         char buf[64];
1091 
1092         /*
1093          * Smatch uses a hack where if we get an unsigned long we say it's
1094          * both user data and it points to user data.  But if we pass it to a
1095          * function which takes an int, then it's just user data.  There's not
1096          * enough bytes for it to be a pointer.
1097          *
1098          */
1099         type = get_arg_type(call->fn, param);
1100         if (type && type_bits(type) < type_bits(&ptr_ctype))
1101                 return;
1102 
1103         if (strcmp(sm->state->name, "") == 0)
1104                 return;




1050 
1051 static void match_call_info(struct expression *expr)
1052 {
1053         struct expression *arg;
1054         struct symbol *type;
1055         char *str;
1056         int i;
1057 
1058         i = -1;
1059         FOR_EACH_PTR(expr->args, arg) {
1060                 i++;
1061                 type = get_arg_type(expr->fn, i);
1062                 str = get_user_rl_str(arg, type);
1063                 if (!str)
1064                         continue;
1065 
1066                 sql_insert_caller_info(expr, USER_DATA, i, "$", str);
1067         } END_FOR_EACH_PTR(arg);
1068 }
1069 















1070 static void struct_member_callback(struct expression *call, int param, char *printed_name, struct sm_state *sm)
1071 {
1072         struct smatch_state *state;
1073         struct range_list *rl;
1074         struct symbol *type;
1075         char buf[64];
1076 
1077         /*
1078          * Smatch uses a hack where if we get an unsigned long we say it's
1079          * both user data and it points to user data.  But if we pass it to a
1080          * function which takes an int, then it's just user data.  There's not
1081          * enough bytes for it to be a pointer.
1082          *
1083          */
1084         type = get_arg_type(call->fn, param);
1085         if (type && type_bits(type) < type_bits(&ptr_ctype))
1086                 return;
1087 
1088         if (strcmp(sm->state->name, "") == 0)
1089                 return;