fix(systembus): align data length to prevent unaligned memory copy operations

This commit is contained in:
Gatsby Van
2024-11-05 23:57:29 +08:00
parent 5ef3ae13c3
commit 2fc4f18729
+1 -1
View File
@@ -175,7 +175,7 @@ int SysbusUart_Recv(SYSBUS_UART *instPtr, SYSBUS_UART_FRAME *frame)
{ {
return EPARAM; return EPARAM;
} }
dWLen = (dLen + FRAME_HEAD_LEN + FRAME_INFO_LEN - 1) / 4 + 1; dWLen = NORMALIZE_SIZE(dLen + FRAME_HEAD_LEN + FRAME_INFO_LEN) / sizeof(uint32_t);
dBuff = malloc(sizeof(uint32_t) * dWLen); dBuff = malloc(sizeof(uint32_t) * dWLen);
if (dBuff == NULL) if (dBuff == NULL)