mirror of
https://github.com/dingusdev/dingusppc.git
synced 2025-01-05 10:30:28 +00:00
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:
parent
2a8e5538b2
commit
372b9cae7a
@ -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;
|
||||
|
@ -55,6 +55,7 @@ protected:
|
||||
uint16_t r_byte_count;
|
||||
bool status_expected = false;
|
||||
|
||||
alignas(uint16_t)
|
||||
uint8_t cmd_pkt[12] = {};
|
||||
};
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user