atapibasedevice: fix unaligned memory access

Both cmd_pkt and data_buf class members are cast to a uint16_t pointer,
so we need to make sure they are properly aligned, otherwise it is
undefined behavior.
This commit is contained in:
Mihai Parparita 2024-08-15 22:32:46 -07:00
parent 2a8e5538b2
commit 372b9cae7a
2 changed files with 2 additions and 0 deletions

View File

@ -96,6 +96,7 @@ protected:
uint16_t *data_ptr = nullptr;
uint16_t *cur_data_ptr = nullptr;
alignas(uint16_t)
uint8_t data_buf[512] = {};
int xfer_cnt = 0;
int chunk_cnt = 0;

View File

@ -55,6 +55,7 @@ protected:
uint16_t r_byte_count;
bool status_expected = false;
alignas(uint16_t)
uint8_t cmd_pkt[12] = {};
};