已合并
告警修复 #5558
已合并
王旭创建于 20 天前
王旭
王旭
20 天前

一、内容说明(相关的Issue)

二、建议测试周期和提测地址

建议测试完成时间:xxxx.xx.xx
投产上线时间:xxxx.xx.xx
提测地址:CI环境/压测环境
测试账号:

三、变更内容

  • 3.1 关联PR列表

  • 3.2 数据库和部署说明

    1. 常规更新
    2. 重启unicorn
    3. 重启sidekiq
    4. 迁移任务:是否有迁移任务,没有写 "无"
    5. rake脚本:bundle exec xxx RAILS_ENV = production;没有写 "无"
  • 3.4 其他技术优化内容(做了什么,变更了什么)

    • 重构了 xxxx 代码
    • xxxx 算法优化
  • 3.5 废弃通知(什么字段、方法弃用?)

  • 3.6 后向不兼容变更(是否有无法向后兼容的变更?)

四、研发自测点(自测哪些?冒烟用例全部自测?)

自测测试结论:

五、测试关注点(需要提醒QA重点关注的、可能会忽略的地方)

检查点:

需求名称 是否影响xx公共模块 是否需要xx功能 需求升级是否依赖其他子产品
xxx 需要 不需要

接口测试:

性能测试:

并发测试:

其他:

likedislike
Pull Request已成功合入, 合并人@openharmony_ci
(感谢 王旭 的贡献)
openharmony_ciopenharmony_ci成员
20 天前 添加了label:waiting_on_author
openharmony_ci
openharmony_ci成员
20 天前 评论:

感谢提交 Pull Requests!如果您提交的PR已经开发完毕,请评论 "start build" 触发门禁,更多交互操作,请访问OpenHarmony社区支持命令清单。如果需要调整订阅PR、Issue的变更状态,请访问订阅链接


Thanks for submitting the pull request. If your Pull Request has already been developed, you can leave a "start build" comment to trigger the gated system. For more commands, please visit OpenHarmony Command List. If you need to change the subscription of a Pull Request or Issue, please visit the link.

likedislike
openharmony_ciopenharmony_ci成员
20 天前 添加了label:dco检查成功
LisaMessi
20 天前 评论:

PR 审查报告:#5558 - 告警修复

仓库:OpenHarmony/communication_wifi
PR 地址https://gitcode.com/openharmony/communication_wifi/merge_requests/5558
作者:王旭 (tradeWindToNorth)
目标分支:master
PR SHA0f243298d249bac7f4c1e8cef4459705081b3008
状态:open
标签waiting_on_authordco检查成功

CI 状态

  • ✅ DCO 检查成功
  • ✅ 冲突检查通过

变更概要

本 PR 修复静态检查告警(1 个文件,+1/-1):StrSafeCopy 增加 len == 0 边界防护。

void StrSafeCopy(char *dst, unsigned len, const char *src)
{
-    if (dst == NULL) {
+    if (dst == NULL || len == 0) {
        return;
    }
    if (src == NULL) {
        ...

问题详情

💡建议

1. 修复正确,但建议确认函数内部对 len - 1 的使用

位置wifi/relation_services/common/wifi_hal_common_func.cStrSafeCopy

描述:新增 len == 0 防护是正确的必要修复:若函数内部存在 len - 1(如 strncpy(dst, src, len - 1) / dst[len - 1] = '\0')类操作,len == 0len - 1unsigned 回绕为 0xFFFFFFFF,将导致缓冲区溢出。静态检查告警正是由此触发。

影响:修复后消除了 len == 0 时的回绕风险;无功能回归(len == 0 时本就无可用空间,提前返回语义正确)。

修复建议:确认函数体内所有 len 运算均受该守卫保护;建议将参数类型与运算显式化,进一步规避回绕类告警:

void StrSafeCopy(char *dst, unsigned int len, const char *src)
{
    if (dst == NULL || src == NULL || len == 0) {
        return;
    }
    /* 若存在 len - 1 类运算,可改为显式判断:
     * if (len <= 1) { dst[0] = '\0'; return; }
     */
    ...
}

2. src == NULL 分支行为需确认

描述src == NULL 时函数行为(清空 dst 或直接返回)未在 diff 中可见。若为直接返回,dst 将保持未初始化状态,调用方可能继续使用脏缓冲区。

影响:潜在未初始化缓冲区使用(若调用方未自行清零)。

修复建议:确认该分支行为;若为直接返回,建议在返回前将 dst 置空:

if (src == NULL) {
    if (len > 0) {
        dst[0] = '\0';
    }
    return;
}

3. 无测试覆盖

该工具函数为核心复制接口(HAL 层通用),建议补充单测覆盖 dst == NULL / len == 0 / src == NULL / 截断场景。

4. 返回值语义

void 返回值使调用方无法感知复制是否成功/截断。可评估改为返回状态码(如 int)或保持现状(本次为最小告警修复,可不扩展)。


总体评分

维度 评分 说明
功能正确性 8/10 修复正确,无回归
代码质量 7/10 最小化改动
安全性 8/10 消除潜在溢出回绕风险
可维护性 7/10 改动清晰
测试充分性 5/10 无测试
综合评分 7/10

审查结论

建议操作:✅ 可以合并

说明:

  • 问题 1 为本 PR 核心修复点,方向正确、语义无回归;
  • 问题 2/3 为可选的后续增强,不阻塞合并。

优点:

  • 精准修复静态检查告警(len == 0 回绕风险)
  • 变更最小(1 文件,+1/-1)
  • DCO 检查通过
likedislike
王旭王旭
20 天前 关联了issue:[Bug]: 告警修复
王旭
王旭
20 天前 评论:

start build

likedislike
openharmony_ci
openharmony_ci成员
20 天前 评论:

首次触发
门禁构建开始,包含静态检查、代码编译和测试【hispark_taurus_Linux编译, dayu200_tdd编译, dayu200编译, hispark_pegasus测试, ohos-host_mini_tdd编译, dayu600_7885编译, x86_64_virt编译, hispark_pegasus_3863编译, hispark_pegasus_3863测试, dayu200测试, dayu600_7885测试, hispark_pegasus编译, master_inner_build编译】,预计在60分钟内完成,门禁结果会同步发送到注册邮箱。您可以通过如下链接跟踪门禁进展:http://dcp.openharmony.cn/workbench/cicd/detail/6a84510d64650f998b2d3574/runlist

likedislike
openharmony_ciopenharmony_ci成员
20 天前 添加了label:编译成功
openharmony_ciopenharmony_ci成员
20 天前 添加了label:静态检查成功
openharmony_ciopenharmony_ci成员
20 天前 添加了label:冒烟测试成功
openharmony_ciopenharmony_ci成员
20 天前 通过测试
openharmony_ci
openharmony_ci成员
20 天前 评论:

代码门禁通过
您可以通过如下链接查看门禁报告:http://dcp.openharmony.cn/workbench/cicd/detail/6a84510d64650f998b2d3574/runlist

静态检查:

# check type result report
1 codeCheck pass >>>

编译测试:
# Device build result test result package
1 hispark_taurus_Linux success NA >>>
2 dayu200 success success >>>
3 dayu200_tdd success NA >>>
4 hispark_pegasus success success >>>
5 master_inner_build success(IGNORE) NA >>>
6 ohos-host_mini_tdd success NA >>>
7 dayu600_7885 success success >>>
8 x86_64_virt success NA >>>
9 hispark_pegasus_3863 success success >>>

likedislike
openharmony_ciopenharmony_ci成员
20 天前 删除了label:waiting_on_author
openharmony_ciopenharmony_ci成员
20 天前 添加了label:waiting_for_review
openharmony_ci
openharmony_ci成员
20 天前 评论:

您好,Committer @wshixjr @bjtu_wujun_transportation @f00651013 @chengguohong ,请分配检视人员检视该PR,可以通过命令"assign [@someone_id]"分配检视人员,也可以直接评论"assign"分配给自己进行检视。


Hello, Committer @wshixjr @bjtu_wujun_transportation @f00651013 @chengguohong . Please assign someone to review the PR. You can assign a reviewer by using the command "assign [@someone_id]", or you can comment "assign" to review the PR by yourself.

likedislike
wujunwujun成员
10 天前 通过审查
openharmony_ci
openharmony_ci成员
10 天前 评论:

验证结果已超过12小时,之前验证结果无效,自动重新触发构建,请关注最新验证结果

likedislike
openharmony_ci
openharmony_ci成员
10 天前 评论:

start build

likedislike
openharmony_ciopenharmony_ci成员
10 天前 删除了label:编译成功
openharmony_ciopenharmony_ci成员
10 天前 删除了label:静态检查成功
openharmony_ciopenharmony_ci成员
10 天前 删除了label:冒烟测试成功
openharmony_ci
openharmony_ci成员
10 天前 评论:

本地或库上代码有更新,全量重新构建,重置所有关联PR的验证状态
门禁构建开始,包含静态检查、代码编译和测试【dayu200_tdd编译, hispark_taurus_Linux编译, dayu600_7885编译, ohos-host_mini_tdd编译, dayu200测试, dayu200编译, hispark_pegasus_3863测试, hispark_pegasus_3863编译, hispark_pegasus测试, master_inner_build编译, hispark_pegasus编译, dayu600_7885测试, x86_64_virt编译】,预计在60分钟内完成,门禁结果会同步发送到注册邮箱。您可以通过如下链接跟踪门禁进展:http://dcp.openharmony.cn/workbench/cicd/detail/6a91346064650f998bfd3450/runlist

likedislike
openharmony_ciopenharmony_ci成员
10 天前 添加了label:编译成功
openharmony_ciopenharmony_ci成员
10 天前 添加了label:静态检查成功
openharmony_ciopenharmony_ci成员
10 天前 添加了label:冒烟测试成功
openharmony_ciopenharmony_ci成员
10 天前 通过测试
openharmony_ci
openharmony_ci成员
10 天前 评论:

代码门禁通过
您可以通过如下链接查看门禁报告:http://dcp.openharmony.cn/workbench/cicd/detail/6a91346064650f998bfd3450/runlist

静态检查:

# check type result report
1 codeCheck pass >>>

编译测试:
# Device build result test result package
1 hispark_taurus_Linux success NA >>>
2 dayu200 success success >>>
3 dayu200_tdd success NA >>>
4 hispark_pegasus success success >>>
5 master_inner_build success(IGNORE) NA >>>
6 ohos-host_mini_tdd success NA >>>
7 dayu600_7885 success success >>>
8 x86_64_virt success NA >>>
9 hispark_pegasus_3863 success(IGNORE) success(IGNORE) >>>

likedislike
openharmony_ci
openharmony_ci成员
10 天前 评论:

您好,Committer @wshixjr @bjtu_wujun_transportation @f00651013 @chengguohong ,请分配检视人员检视该PR,可以通过命令"assign [@someone_id]"分配检视人员,也可以直接评论"assign"分配给自己进行检视。


Hello, Committer @wshixjr @bjtu_wujun_transportation @f00651013 @chengguohong . Please assign someone to review the PR. You can assign a reviewer by using the command "assign [@someone_id]", or you can comment "assign" to review the PR by yourself.

likedislike
openharmony_ciopenharmony_ci成员
10 天前 关闭了关联的issue
openharmony_ciopenharmony_ci成员
10 天前 合入了pull request,合并节点 SHA:5a71a4cf62d6f77cf4fc3ad8e6cca178cecd9bd6
openharmony_ciopenharmony_ci成员
10 天前 删除了label:waiting_for_review
openharmony_ciopenharmony_ci成员
10 天前 添加了label:merged