Pull Request已成功合入, 合并人@CANN-robot
(感谢 xtqh 的贡献)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
PR Approval Progress
✅ Congratulations! All modules have met the lgtm and approve requirements.
Module Approval Details
| module | lgtm status | approve status |
|---|---|---|
| README.md | ✅ wang-minbo, 黄俊健 (2/2) | ✅ 黄俊健, wang-minbo (2/1) |
| docs | ✅ 黄俊健, wang-minbo (2/2) | ✅ 黄俊健, wang-minbo (2/1) |
| examples | ✅ wang-minbo, 黄俊健 (2/2) | ✅ wang-minbo, 黄俊健 (2/1) |
💡 Tip:
- Committer can comment
/approveor/lgtm- Commenting
/approveimplies both code review (lgtm) and intent to merge (approve)
CLA Signature Pass
xtqh, thanks for your pull request. All authors of the commits have signed the CLA. 👍


流水线任务触发成功
任务链接 [277582dc700f4008a3b4324755f3d305][流水线指导]
| 任务名称 | 状态 | 日志 | 下载链接 |
|---|---|---|---|
| Compile_Ascend_X86 | ✅ SUCCESS | >>>>> | >>>>> |
| Compile_Ascend_ARM | ✅ SUCCESS | >>>>> | >>>>> |
| Compile_Ascend_X86_mobile_station | ✅ SUCCESS | >>>>> | >>>>> |
| Compile_Ascend_X86_experimental | ✅ SUCCESS | >>>>> | >>>>> |
| Compile_Ascend_ARM_experimental | ✅ SUCCESS | >>>>> | >>>>> |
| Compile_Pre | ✅ SUCCESS | >>>>> | |
| pre_comment | ✅ SUCCESS | >>>>> | |
| Compile_Ascend_X86_ubuntu24 | ✅ SUCCESS | >>>>> | >>>>> |
| Compile_Ascend_X86_mobile_station_ubuntu24 | ✅ SUCCESS | >>>>> | >>>>> |
| Compile_Ascend_ARM_ubuntu24 | ✅ SUCCESS | >>>>> | >>>>> |
| Compile_Ascend_X86_experimental_ubuntu24 | ✅ SUCCESS | >>>>> | >>>>> |
| Compile_Ascend_ARM_experimental_ubuntu24 | ✅ SUCCESS | >>>>> | >>>>> |
| Compile_X86_monitor_910b | ✅ SUCCESS | >>>>> | >>>>> |
| Compile_X86_monitor_910c | ✅ SUCCESS | >>>>> | >>>>> |
| Compile_X86_monitor_950 | ✅ SUCCESS | >>>>> | >>>>> |
| Compile_Ascend_X86_experimental_950 | ✅ SUCCESS | >>>>> | >>>>> |
| Compile_Ascend_ARM_experimental_950 | ✅ SUCCESS | >>>>> | >>>>> |
| Compile_Ascend_X86_experimental_950_ubuntu24 | ✅ SUCCESS | >>>>> | >>>>> |
| Compile_Ascend_ARM_experimental_950_ubuntu24 | ✅ SUCCESS | >>>>> | >>>>> |
| UT_Test | ✅ SUCCESS | ||
| PreSmoke_A900 | ✅ SUCCESS | >>>>> | |
| API_Check | ✅ SUCCESS | >>>>> | |
| PreSmoke_ATK_Test_A2 | ✅ SUCCESS | >>>>> |
[2026-06-04 21:13:43] CI执行结束


流水线任务触发成功
任务链接 [29b311374b0b4797899eb4f94b9271a4][流水线指导]
| 任务名称 | 状态 | 日志 | 下载链接 |
|---|---|---|---|
| codecheck | ✅ SUCCESS | >>>>> | |
| SCA | ✅ SUCCESS | >>>>> | |
| antipoison | ✅ SUCCESS | >>>>> | |
| codecheck_style | ✅ SUCCESS | >>>>> | |
| StaticCheck_codespell_check | ⚠️ WARNING | >>>>> | |
| StaticCheck_link_validity_check | ✅ SUCCESS | ||
| StaticCheck_resource_existence_check | ✅ SUCCESS | ||
| StaticCheck_tag_closed_check | ✅ SUCCESS | ||
| StaticCheck_markdownlint | ⚠️ WARNING | >>>>> | |
| codecheck_checkpr | ✅ SUCCESS | ||
| codecheck_precommit | ⚠️ WARNING | >>>>> | >>>>> |
[2026-06-04 21:05:11] CI执行结束


/lgtm
/approve


[SEC-5.1] 资源申请后判断是否成功
问题描述:GenOnesDataFloat32 和 GenOnesData 使用 new(std::nothrow) 分配内存后,均未对返回值做 nullptr 判断就直接解引用。若分配失败,pData 为 nullptr,后续 *(pData + i) = value 将触发空指针解引用(未定义行为)。
代码片段(行 140-145):
float *pData = new (std::nothrow) float[size]; // nothrow分配,失败返回nullptr
for (size_t i = 0; i < size; ++i) {
*(pData + i) = value; // 无nullptr判断,直接解引用
}
input_tensor = Tensor(input_tensor_desc, (uint8_t *)pData, data_len);
return SUCCESS;
代码片段(行 158-162):
int32_t *pData = new (std::nothrow) int32_t[data_len]; // nothrow分配,失败返回nullptr
for (uint32_t i = 0; i < size; ++i) {
*(pData + i) = value; // 无nullptr判断,直接解引用
}
修复建议:在 new(std::nothrow) 之后添加 nullptr 判断:if (pData == nullptr) { return FAILE


/approve


The MR can not be merged, because of CodeReview discussion not resolved
If you want to solve this problem, you can click here to do it in the FAQs.


/approve


The MR can not be merged, because of CodeReview discussion not resolved
If you want to solve this problem, you can click here to do it in the FAQs.


描述
优化项目快速入门与算子调用相关文档,提升开发者体验和文档可读性。
改动
关联的Issue
#2908
https://gitcode.com/cann/ops-transformer/issues/2421
测试
类型标签