Lines Matching refs:type

80 		return "UBSAN: type mismatch";
134 static bool type_is_int(struct type_descriptor *type)
136 return type->type_kind == type_kind_int;
139 static bool type_is_signed(struct type_descriptor *type)
141 WARN_ON(!type_is_int(type));
142 return type->type_info & 1;
145 static unsigned type_bit_width(struct type_descriptor *type)
147 return 1 << (type->type_info >> 1);
150 static bool is_inline_int(struct type_descriptor *type)
153 unsigned bits = type_bit_width(type);
155 WARN_ON(!type_is_int(type));
160 static s_max get_signed_val(struct type_descriptor *type, void *val)
162 if (is_inline_int(type)) {
163 unsigned extra_bits = sizeof(s_max)*8 - type_bit_width(type);
169 if (type_bit_width(type) == 64)
175 static bool val_is_negative(struct type_descriptor *type, void *val)
177 return type_is_signed(type) && get_signed_val(type, val) < 0;
180 static u_max get_unsigned_val(struct type_descriptor *type, void *val)
182 if (is_inline_int(type))
185 if (type_bit_width(type) == 64)
191 static void val_to_string(char *str, size_t size, struct type_descriptor *type,
194 if (type_is_int(type)) {
195 if (type_bit_width(type) == 128) {
197 u_max val = get_unsigned_val(type, value);
207 } else if (type_is_signed(type)) {
209 (s64)get_signed_val(type, value));
212 (u64)get_unsigned_val(type, value));
243 struct type_descriptor *type = data->type;
250 ubsan_prologue(&data->location, type_is_signed(type) ?
254 val_to_string(lhs_val_str, sizeof(lhs_val_str), type, lhs);
255 val_to_string(rhs_val_str, sizeof(rhs_val_str), type, rhs);
256 pr_err("%s %c %s cannot be represented in type %s\n",
260 type->type_name);
297 val_to_string(old_val_str, sizeof(old_val_str), data->type, old_val);
299 pr_err("negation of %s cannot be represented in type %s:\n",
300 old_val_str, data->type->type_name);
317 val_to_string(rhs_val_str, sizeof(rhs_val_str), data->type, rhs);
319 if (type_is_signed(data->type) && get_signed_val(data->type, rhs) == -1)
320 pr_err("division of %s by -1 cannot be represented in type %s\n",
321 rhs_val_str, data->type->type_name);
336 pr_err("%s null pointer of type %s\n",
338 data->type->type_name);
351 pr_err("%s misaligned address %p for type %s\n",
353 (void *)ptr, data->type->type_name);
369 pr_err("for an object of type %s\n", data->type->type_name);
393 .type = data->type,
407 .type = data->type,
427 pr_err("index %s is out of range for type %s\n", index_str,
455 pr_err("shift exponent %s is too large for %u-bit type %s\n",
464 " represented in type %s\n",
496 val_to_string(val_str, sizeof(val_str), data->type, val);
498 pr_err("load of value %s is not a valid value for type %s\n",
499 val_str, data->type->type_name);
520 pr_err("assumption of %lu byte alignment (with offset of %lu byte) for pointer of type %s failed",
521 align, offset, data->type->type_name);
523 pr_err("assumption of %lu byte alignment for pointer of type %s failed",
524 align, data->type->type_name);