Ignore:
Timestamp:
2023-07-25T13:09:37Z (2 years ago)
Author:
Vojtech Horky <vojtech.horky@…>
Branches:
ticket/834-toolchain-update
Children:
27bfbed
Parents:
1f6bf85
git-author:
Vojtech Horky <vojtech.horky@…> (2023-07-25 13:09:35)
git-committer:
Vojtech Horky <vojtech.horky@…> (2023-07-25 13:09:37)
Message:

Fix packed structures

attribute(packed) actually implies also align(1): thus
the compiler can place the whole structure to arbitrary address.
This commit fixes that by adding explicit align to some of
these structures (where compiler produced a warning).

Following reports explain the issues around packed attribute:

File:
1 edited

Legend:

Unmodified
Added
Removed
  • uspace/lib/ext4/include/ext4/types.h

    r1f6bf85 r4b992266  
    141141        uint32_t encrypt_algos;             /* Encrypt algorithm in use */
    142142        uint32_t padding[105];              /* Padding to the end of the block */
    143 } __attribute__((packed)) ext4_superblock_t;
     143} __attribute__((packed))  __attribute__((aligned(4))) ext4_superblock_t;
    144144
    145145#define EXT4_GOOD_OLD_REV 0
     
    345345        uint32_t crtime_extra;  /* Extra file creation time (nsec << 2 | epoch) */
    346346        uint32_t version_hi;    /* High 32 bits for 64-bit version */
    347 } __attribute__((packed)) ext4_inode_t;
     347} __attribute__((packed)) __attribute__((aligned(4))) ext4_inode_t;
    348348
    349349#define EXT4_INODE_MODE_FIFO       0x1000
Note: See TracChangeset for help on using the changeset viewer.