mtd: SET loses the consolidation error and can report -ENOMEM

未关闭 适合新手
#22,316 0 条评论 0 个 reaction 已指派 0 人 在 GitHub 查看

维护者通常 1 天内回复

还没有人认领这个 Issue。

评估

难度
2/5
预计耗时
1-3 小时
新手友好度
62/100
Issue 类型
缺陷
描述清晰度
基本清楚
活跃度
活跃
技术栈
c
领域
embedded-iot

调研方向

从 drivers/mtd/mtd_config.c 开始,查看第 730-733 行附近的合并辅助函数及其错误返回值,然后查看第 1000-1003 行、1313 行和 1328 行附近丢弃返回值的 SET 调用点。检查辅助函数的失败哨兵值如何被使用,以及 MTD 的读/写/擦除错误能否回传给调用者。完成的标准是:合并过程中的 I/O 错误能够到达 SET 的调用者,而不是经过重试的搜索最终以 -ENOMEM 结束。

由索引模型根据 Issue 内容生成。

描述

Mechanism. The consolidation helper returns 0 as its failure sentinel. SET ignores that value, retries the free-entry search, and can end up returning -ENOMEM even though the real failure was an I/O error during consolidation.

Effect. The caller sees a misleading -ENOMEM (or an apparently successful retry) instead of the underlying I/O failure, and the diagnostic information from the original error is lost.

Location. drivers/mtd/mtd_config.c:730-733, :1000-1003, :1313, :1328 (master f284e6d7).

Trigger. A consolidation pass during SET hits an MTD write/erase error.

Expected. The original I/O error reaches the caller.

Evidence. Source inspection only: both error returns yield 0, and both call sites discard the return value.

Patch. Return the underlying error from the consolidation helper and propagate it from SET.

主要语言
C
星标
4.1k
派生
1.8k
平均合并
1 天 17 小时
30 天内合并 PR
900

环境准备

从这里开始

  1. 先读完整个 Issue,再读项目的贡献指南。
  2. 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
  3. Fork 仓库,在一个分支上完成修改。
  4. 提交 Pull Request,并在描述里引用这个 Issue 编号。

apache/nuttx 的其他 Issue

查看 apache/nuttx 的全部 Issue

相似的 Issue

更多 C Issue

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。