OpenAtomFoundation / TobudOS

开放原子开源基金会孵化的物联网操作系统,捐赠前为腾讯物联网终端操作系统TencentOS Tiny
https://cloud.tencent.com/product/tos-tiny
5.97k stars 1.61k forks source link

[HUST-CSE]Add null pointer check in OSA_TaskSetPriority #359

Closed cospine closed 1 year ago

cospine commented 1 year ago

1.这个PR修复的是什么问题?

源码 : if (ptaskStruct->priority > tcb->priority) 这段代码在while循环未进入时,tcb易产生空指针问题 此处给出文件路径: platform/vendor_bsp/nxp/MIMXRT1052/components/osa/fsl_os_abstraction_bm.c

2.这个PR不修复具体会带来什么后果?

tcb->priority无效,并会导致指针错误、程序崩溃

3.PR修复方案的依据是什么?

在原判断条件的基础上,添加对于空指针的检验,保证了代码的安全性: if ((NULL == tcb) || (ptaskStruct->priority > tcb->priority))

4. 在什么环境下测试或者验证过?

all

tencent-adm commented 1 year ago

CLA assistant check
Thank you for your submission, we really appreciate it. Like many open source projects, we ask that you sign our Contributor License Agreement before we can accept your contribution.
You have signed the CLA already but the status is still pending? Let us recheck it.