mirror of
https://github.com/espressif/esp-idf.git
synced 2024-10-05 20:47:46 -04:00
psram: fix esp32/esp_psram_impl_quad memcpy out of bounds issue
This commit is contained in:
parent
cdad8a02fe
commit
26df228b11
@ -355,7 +355,9 @@ static int psram_cmd_config(psram_spi_num_t spi_num, psram_cmd_t* pInData)
|
|||||||
// Load send buffer
|
// Load send buffer
|
||||||
int len = (pInData->txDataBitLen + 31) / 32;
|
int len = (pInData->txDataBitLen + 31) / 32;
|
||||||
if (p_tx_val != NULL) {
|
if (p_tx_val != NULL) {
|
||||||
memcpy((void*)SPI_W0_REG(spi_num), p_tx_val, len * 4);
|
for (int i = 0; i < len; i++) {
|
||||||
|
WRITE_PERI_REG(SPI_W0_REG(spi_num), p_tx_val[i]);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
// Set data send buffer length.Max data length 64 bytes.
|
// Set data send buffer length.Max data length 64 bytes.
|
||||||
SET_PERI_REG_BITS(SPI_MOSI_DLEN_REG(spi_num), SPI_USR_MOSI_DBITLEN, (pInData->txDataBitLen - 1),
|
SET_PERI_REG_BITS(SPI_MOSI_DLEN_REG(spi_num), SPI_USR_MOSI_DBITLEN, (pInData->txDataBitLen - 1),
|
||||||
|
Loading…
x
Reference in New Issue
Block a user