rt-thread-official/components/drivers
LaterComer 82bb104f65
fix(serial_v2): tx_fifo->rb.buffer_ptr not init when RT_DEVICE_FLAG_DMA_TX and RT_SERIAL_TX_BLOCKING
为什么提交这份PR (why to submit this PR)
serial_v2驱动框架,rt_serial_tx_enable()函数,在 DMA阻塞发送(RT_DEVICE_FLAG_DMA_TX and RT_SERIAL_TX_BLOCKING) 的时候,使用rt_malloc分配了tx_fifo内存,但是并未对tx_fifo->rb.buffer_ptr指针进行初始化(rt_malloc不会自动初始化内存),因此可能导致buffer_ptr是一个随机指针。但是rt_serail_write()函数需要根据tx_fifo->rb.buffer_ptr是否为RT_NULL来判断是调用_serial_fifo_tx_blocking_nbuf()还是_serial_fifo_tx_blocking_buf()。

由于tx_fifo->rb.buffer_ptr可能是一个随机值(不一定为RT_NULL=0),导致RT_DEVICE_FLAG_DMA_TX and RT_SERIAL_TX_BLOCKING模式下调用了_serial_fifo_tx_blocking_buf(),但是rb没有真正开辟内存空间,导致内存异常

你的解决方案是什么 (what is your solution)
rt_serial_tx_enable(),在DMA阻塞发送分支下,对tx_fifo->rb.buffer_ptr进行初始化,赋值为RT_NULL。
2024-02-21 00:29:53 -05:00
..
audio [HUST CSE] Fix many abnormal symbols in annotations and format code 2023-04-17 22:26:23 -04:00
can [components][drivers][can]Init can tx completion flag before tx 2023-08-18 23:33:20 -04:00
clk [component][drivers]add clk framework (#8213) 2023-12-24 19:53:12 +08:00
core [drivers][core] 完善设备模型 (#8384) 2024-01-09 23:10:42 +08:00
cputime [component][drivers][cputime]Fix timer dev (#7442) 2023-05-07 23:14:39 +08:00
fdt [component][fdt]添加设备树子节点寻找宏 (#7377) 2023-06-27 10:09:51 -04:00
hwcrypto [HUST CSE] Fix many abnormal symbols in annotations and format code 2023-04-17 22:26:23 -04:00
hwtimer overflow is invalid in oneshot mode 2023-07-21 00:28:31 -04:00
i2c soft_i2c: Loop iteration variable: Conform to C89 2023-11-26 18:40:02 +08:00
include [qspi]修复qspi配置未生效问题 2024-02-17 01:07:19 -05:00
ipc 🎈 perf: perf rt_hw_interrupt_disable/enable (#8042) 2023-10-25 20:31:25 +08:00
ktime 🎈 perf: perf rt_hw_interrupt_disable/enable (#8042) 2023-10-25 20:31:25 +08:00
misc [pwm] Fix compiler warning 2023-12-26 12:12:31 +08:00
mtd [HUST CSE] Fix many abnormal symbols in annotations and format code 2023-04-17 22:26:23 -04:00
ofw [drivers][core] 完善设备模型 (#8384) 2024-01-09 23:10:42 +08:00
phy [HUST CSE] Fix many abnormal symbols in annotations and format code 2023-04-17 22:26:23 -04:00
pic 【dd2.0】Support the Core API for dd2.0 (#7791) 2023-07-13 14:49:35 +08:00
pm [libcpu][aarch64] 使用设备树对CPU进行初始化 (#8221) 2023-11-28 14:20:11 +08:00
rtc fix warning #1295-D Deprecated declaration 2023-12-19 19:02:43 +08:00
sdio fix MDK AC5 build warnings 2024-02-03 21:43:08 -05:00
sensor [components][drivers][sensor]暂时禁止使用sensorv2框架 2023-12-26 20:32:28 +08:00
serial fix(serial_v2): tx_fifo->rb.buffer_ptr not init when RT_DEVICE_FLAG_DMA_TX and RT_SERIAL_TX_BLOCKING 2024-02-21 00:29:53 -05:00
spi [qspi]修复qspi配置未生效问题 2024-02-17 01:07:19 -05:00
touch [HUST CSE] Fix many abnormal symbols in annotations and format code 2023-04-17 22:26:23 -04:00
tty 🎈 perf: perf rt_hw_interrupt_disable/enable (#8042) 2023-10-25 20:31:25 +08:00
usb fix(serial_v2): tx_fifo->rb.buffer_ptr not init when RT_DEVICE_FLAG_DMA_TX and RT_SERIAL_TX_BLOCKING 2024-02-21 00:29:53 -05:00
virtio [kernel][dm]适配新的设备驱动模型 (#8075) 2023-10-18 20:50:30 +08:00
watchdog [HUST CSE] Fix many abnormal symbols in annotations and format code 2023-04-17 22:26:23 -04:00
wlan fix MDK AC5 build warnings 2024-02-03 21:43:08 -05:00
Kconfig [components][drivers][sensor]暂时禁止使用sensorv2框架 2023-12-26 20:32:28 +08:00
SConscript Re-normalizing the repo 2013-01-08 22:40:58 +08:00