dfs:fix uninitialized 9pfs protocol lookup#11345
dfs:fix uninitialized 9pfs protocol lookup#11345Aphlita wants to merge 2 commits intoRT-Thread:masterfrom
Conversation
|
👋 感谢您对 RT-Thread 的贡献!Thank you for your contribution to RT-Thread! 为确保代码符合 RT-Thread 的编码规范,请在你的仓库中执行以下步骤运行代码格式化工作流(如果格式化CI运行失败)。 🛠 操作步骤 | Steps
完成后,提交将自动更新至 如有问题欢迎联系我们,再次感谢您的贡献!💐 |
📌 Code Review Assignment🏷️ Tag: componentsReviewers: @Maihuanyi Changed Files (Click to expand)
📊 Current Review Status (Last Updated: 2026-04-26 09:45 CST)
📝 Review Instructions
|
拉取/合并请求描述:(PR description)
[
为什么提交这份PR (why to submit this PR)
dfs_9pfs_mount()在查找9pfs protocol tag前声明了未初始化的p9p指针。如果_protocol_nodes为空,或者没有找到匹配的 tag,后续if (!p9p)会读取未初始化的局部指针,导致mount失败路径依赖不确定的栈值,而不是稳定返回错误。你的解决方案是什么 (what is your solution)
将
p9p初始化为RT_NULL,这样没有匹配protocol tag时,dfs_9pfs_mount()会稳定返回-RT_EINVAL。该修改只影响9pfs mount的错误路径,不改变成功路径行为。请提供验证的bsp和config (provide the config and bsp)
bsp/k210.config本地验证:
git diff --check -- components/dfs/dfs_v1/filesystems/9pfs/dfs_9pfs.ccppcheck --enable=warning,style,performance,portability --quiet components/dfs/dfs_v1/filesystems/9pfs/dfs_9pfs.c说明:本地尝试执行
scons -j2验证bsp/k210,但本地环境缺少BSP配置的RISC-V工具链路径/opt/gnu-mcu-eclipse/riscv-none-gcc/8.2.0-2.1-20190425-1021/bin,因此未完成板级构建。]
当前拉取/合并请求的状态 Intent for your PR
必须选择一项 Choose one (Mandatory):
代码质量 Code Quality:
我在这个拉取/合并请求中已经考虑了 As part of this pull request, I've considered the following:
#if 0代码,不包含已经被注释了的代码 All redundant code is removed and cleaned up