跳到主要内容

sa1100_setup_mtd

API 概述

sa1100_setup_mtdLinux kernel 中的一个API。该规属于return value check 类型。该规则是使用 APISpecGen 生成的。

规则描述

提示

sa1100_setup_mtd returns error pointer on failure, use IS_ERR to check the return value

信息

标签:return value check

参数下标:N/A

CWE类别:CWE-253

规则代码


import cpp
import semmle.code.cpp.controlflow.SSA


class EVPFunctionCall extends FunctionCall {
EVPFunctionCall() {
this.getTarget().hasName("sa1100_setup_mtd")
}
}


predicate isErrCheckFunction(Function f) {
f.hasName("IS_ERR")
}

from EVPFunctionCall call, ValueAccess ret
where
ret = call.getAnAccess() and
not exists(FunctionCall check |
isErrCheckFunction(check.getTarget()) and
check.getArgument(0).getAChild*() = ret
)
select call, "The return value of sa1100_setup_mtd is not checked with IS_ERR."