Changeset 4b992266 in mainline


Ignore:
Timestamp:
2023-07-25T13:09:37Z (10 months 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:

Location:
uspace
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • uspace/drv/bus/usb/xhci/hw_struct/context.h

    r1f6bf85 r4b992266  
    107107#define XHCI_EP_MAX_ESIT_PAYLOAD_HI(ctx) XHCI_DWORD_EXTRACT((ctx).data[0], 31, 24)
    108108
    109 } __attribute__((packed)) xhci_ep_ctx_t;
     109} __attribute__((packed)) __attribute__((aligned(8))) xhci_ep_ctx_t;
    110110
    111111enum {
     
    165165#define XHCI_SLOT_STATE(ctx)            XHCI_DWORD_EXTRACT((ctx).data[3], 31, 27)
    166166
    167 } __attribute__((packed)) xhci_slot_ctx_t;
     167} __attribute__((packed)) __attribute__((aligned(4))) xhci_slot_ctx_t;
    168168
    169169enum {
     
    222222#define XHCI_STREAM_DEQ_PTR_SET(ctx, val) \
    223223        xhci_qword_set_bits(&(ctx).data[0], (val >> 4), 63, 4)
    224 } __attribute__((packed)) xhci_stream_ctx_t;
     224} __attribute__((packed)) __attribute__((aligned(8))) xhci_stream_ctx_t;
    225225
    226226/**
  • 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.