omap_gem_new_dmabuf
API 概述
omap_gem_new_dmabuf 是 Linux kernel 中的一个API。该规属于return value check 类型。该规则是使用 APISpecGen 生成的。
规则描述
提示
omap_gem_new_dmabuf 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("omap_gem_new_dmabuf")
}
}
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 omap_gem_new_dmabuf is not checked with IS_ERR."