Changeset 001957b6 in mainline for kernel/generic/src/debug/util.h


Ignore:
Timestamp:
2023-10-26T20:20:55Z (15 months ago)
Author:
Jiří Zárevúcky <zarevucky.jiri@…>
Branches:
master, topic/msim-upgrade, topic/simplify-dev-export
Children:
0373af9
Parents:
2fbb42f
Message:

ccheck

File:
1 edited

Legend:

Unmodified
Added
Removed
  • kernel/generic/src/debug/util.h

    r2fbb42f r001957b6  
    5454}
    5555
     56/* Casting to these structures allows us to read unaligned integers safely. */
     57struct u16 {
     58        uint16_t val;
     59} __attribute__((packed));
     60
     61struct u32 {
     62        uint32_t val;
     63} __attribute__((packed));
     64
     65struct u64 {
     66        uint64_t val;
     67} __attribute__((packed));
     68
    5669inline uint16_t read_uint16(const uint8_t **data, const uint8_t *data_end)
    5770{
    58         /* Casting to these structures allows us to read unaligned integers safely. */
    59         struct u16 {
    60                 uint16_t val;
    61         } __attribute__((packed));
    62 
    6371        if (*data + 2 > data_end) {
    6472                /* Safe exit path for malformed input. */
     
    92100inline uint32_t read_uint32(const uint8_t **data, const uint8_t *data_end)
    93101{
    94         struct u32 {
    95                 uint32_t val;
    96         } __attribute__((packed));
    97 
    98102        if (*data + 4 > data_end) {
    99103                /* Safe exit path for malformed input. */
     
    109113inline uint64_t read_uint64(const uint8_t **data, const uint8_t *data_end)
    110114{
    111         struct u64 {
    112                 uint64_t val;
    113         } __attribute__((packed));
    114 
    115115        if (*data + 8 > data_end) {
    116116                /* Safe exit path for malformed input. */
Note: See TracChangeset for help on using the changeset viewer.