Changeset 001957b6 in mainline for kernel/generic/src/debug/util.h
- Timestamp:
- 2023-10-26T20:20:55Z (15 months ago)
- Branches:
- master, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- 0373af9
- Parents:
- 2fbb42f
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
kernel/generic/src/debug/util.h
r2fbb42f r001957b6 54 54 } 55 55 56 /* Casting to these structures allows us to read unaligned integers safely. */ 57 struct u16 { 58 uint16_t val; 59 } __attribute__((packed)); 60 61 struct u32 { 62 uint32_t val; 63 } __attribute__((packed)); 64 65 struct u64 { 66 uint64_t val; 67 } __attribute__((packed)); 68 56 69 inline uint16_t read_uint16(const uint8_t **data, const uint8_t *data_end) 57 70 { 58 /* Casting to these structures allows us to read unaligned integers safely. */59 struct u16 {60 uint16_t val;61 } __attribute__((packed));62 63 71 if (*data + 2 > data_end) { 64 72 /* Safe exit path for malformed input. */ … … 92 100 inline uint32_t read_uint32(const uint8_t **data, const uint8_t *data_end) 93 101 { 94 struct u32 {95 uint32_t val;96 } __attribute__((packed));97 98 102 if (*data + 4 > data_end) { 99 103 /* Safe exit path for malformed input. */ … … 109 113 inline uint64_t read_uint64(const uint8_t **data, const uint8_t *data_end) 110 114 { 111 struct u64 {112 uint64_t val;113 } __attribute__((packed));114 115 115 if (*data + 8 > data_end) { 116 116 /* Safe exit path for malformed input. */
Note:
See TracChangeset
for help on using the changeset viewer.