Pull Request has been successfully merged by CANN-robot.
(Thank you for h9718w's contribution.)变更摘要
本 PR 针对 codecheck 检查发现的告警进行清理,主要涉及 profiler 与 block 算子相关代码。核心改动集中在 python/pypto_pro/include/pypto_profiler.h:将 CacheCaptureTensorInfo 中的不安全检查 std::memcpy 替换为带目标缓冲区容量校验的 memcpy_s,并引入 securec.h、cstdint 头文件及 uint8_t 类型;同时在对应单元测试中补充了 memcpy_s 的桩实现。memory.cpp 仅做了一处空行清理。
主要改动
- 引入安全拷贝接口:
pypto_profiler.h中新增#include "securec.h"与#include <cstdint>,为使用安全内存操作函数做准备。 - 缓冲区类型统一:
CacheCaptureTensorInfo中声明的buffer由unsigned char*改为uint8_t*。 - 替换
memcpy为memcpy_s: 将两次std::memcpy调用改为(void)memcpy_s(...),并为其传入目标缓冲区剩余大小(size与size - offset),以满足安全拷贝的容量校验要求。 - 补充测试桩实现:
test_native_prof_tensor_info.py中新增extern "C" errno_t memcpy_s(...),通过断言count <= destMax并转调std::memcpy模拟该接口。 - 格式清理:
framework/src/interface/ir/op/block_ops/memory.cpp的DeduceSubViewType中删除一行空行,属无业务影响的格式调整。


Thanks for your pull-request.
The full list of commands accepted by me can be found at here.
You can get sig-info at here.
You can self-configure the PR merge rules for this repository. For more details, please refer to Here.
For more, you also can visit HICANN.
PR Approval Progress
✅ Congratulations! All modules have met the lgtm and approve requirements.
Module Approval Details
| module | lgtm status | approve status |
|---|---|---|
| 9.2.0 | ✅ gcw_kUomxQ2l, gaoxiang618 (2/2) | ✅ gcw_kUomxQ2l (1/1) |
💡 Tip:
- Committer can comment
/approveor/lgtm- Commenting
/approveimplies both code review (lgtm) and intent to merge (approve)


/compile


| 🚀 CI 流水线已启动 |
|---|
| 📋 执行详情: 点击查看流水线 |


/approve
/lgtm


/approve


The following users do not have permission to comment /lgtm or /approve on any module in this PR:
/approve: gaoxiang618


/compile


| 🚀 CI 流水线已启动 |
|---|
| 📋 执行详情: 点击查看流水线 |


/compile


| 🚀 CI 流水线已启动 |
|---|
| 📋 执行详情: 点击查看流水线 |


修复 codecheck 告警:pypto_profiler.h 将原始 unsigned char* 缓冲改为 uint8_t*、两处 std::memcpy 改为 memcpy_s(引入 securec.h);删除 memory.cpp 中调用与返回值判断之间的多余空行;并在 profiler 单测中补 memcpy_s 桩。另新增 UT,验证通过