Back to home page

OSCL-LXR

 
 

    


0001 /* SPDX-License-Identifier: GPL-2.0 */
0002 #ifndef _LIB_UBSAN_H
0003 #define _LIB_UBSAN_H
0004 
0005 enum {
0006     type_kind_int = 0,
0007     type_kind_float = 1,
0008     type_unknown = 0xffff
0009 };
0010 
0011 struct type_descriptor {
0012     u16 type_kind;
0013     u16 type_info;
0014     char type_name[1];
0015 };
0016 
0017 struct source_location {
0018     const char *file_name;
0019     union {
0020         unsigned long reported;
0021         struct {
0022             u32 line;
0023             u32 column;
0024         };
0025     };
0026 };
0027 
0028 struct overflow_data {
0029     struct source_location location;
0030     struct type_descriptor *type;
0031 };
0032 
0033 struct type_mismatch_data {
0034     struct source_location location;
0035     struct type_descriptor *type;
0036     unsigned long alignment;
0037     unsigned char type_check_kind;
0038 };
0039 
0040 struct type_mismatch_data_v1 {
0041     struct source_location location;
0042     struct type_descriptor *type;
0043     unsigned char log_alignment;
0044     unsigned char type_check_kind;
0045 };
0046 
0047 struct type_mismatch_data_common {
0048     struct source_location *location;
0049     struct type_descriptor *type;
0050     unsigned long alignment;
0051     unsigned char type_check_kind;
0052 };
0053 
0054 struct nonnull_arg_data {
0055     struct source_location location;
0056     struct source_location attr_location;
0057     int arg_index;
0058 };
0059 
0060 struct out_of_bounds_data {
0061     struct source_location location;
0062     struct type_descriptor *array_type;
0063     struct type_descriptor *index_type;
0064 };
0065 
0066 struct shift_out_of_bounds_data {
0067     struct source_location location;
0068     struct type_descriptor *lhs_type;
0069     struct type_descriptor *rhs_type;
0070 };
0071 
0072 struct unreachable_data {
0073     struct source_location location;
0074 };
0075 
0076 struct invalid_value_data {
0077     struct source_location location;
0078     struct type_descriptor *type;
0079 };
0080 
0081 struct alignment_assumption_data {
0082     struct source_location location;
0083     struct source_location assumption_location;
0084     struct type_descriptor *type;
0085 };
0086 
0087 #if defined(CONFIG_ARCH_SUPPORTS_INT128)
0088 typedef __int128 s_max;
0089 typedef unsigned __int128 u_max;
0090 #else
0091 typedef s64 s_max;
0092 typedef u64 u_max;
0093 #endif
0094 
0095 #endif