rt-thread/components
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
..
dfs [components][dfs]修复FATFS文件系统使用cat命令导致断言bug 2023-12-28 18:51:56 +08:00
drivers 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
fal [fal] Add blocks mechanism to fal. (#8252) 2023-11-13 22:49:16 +08:00
finsh [msh] fix the version command (#8531) 2024-02-09 19:56:52 +08:00
legacy [rtdef] use lower-case to define attributes (#6728) 2022-12-11 13:12:03 -05:00
libc [sys_bind] [signalfd] update (#8507) 2024-01-26 22:14:02 +08:00
lwp [ci] open ci check with function declaration warning (#8546) 2024-02-20 22:45:04 -05:00
mm [libcpu][aarch64] 使用设备树对内存进行初始化 (#8320) 2023-12-16 18:08:11 +08:00
mprotect 实现MPU抽象层 (#8080) 2023-10-30 08:24:55 -04:00
net [components][at] 优化AT组件,并解决内存泄露 2024-02-18 11:07:05 -05:00
utilities [kservice] MT-safe output support (kprintf/kputs) 2024-01-16 00:59:18 +08:00
vbus [kconfig] fix Kconfig warnings 2023-12-25 20:28:46 +08:00
Kconfig [msh] add dependency of RT_USING_CONSOLE 2023-12-01 14:43:05 +08:00
SConscript [components] 移除对老版本bsp的lwip版本默认选定 2021-06-28 15:33:14 +08:00