提交 6f874baf 编写于 作者: G Gustavo A. R. Silva 提交者: Samuel Ortiz

NFC: add NULL checks to avoid potential NULL pointer dereference

NULL checks at line 457: if (!link0 || !link1) {, implies that both
pointers link0 and link1 might be NULL.
Function nfcsim_link_free() dereference pointers link0 and link1.
Add NULL checks before calling nfcsim_link_free() to avoid a
potential NULL pointer dereference.

Addresses-Coverity-ID: 1364857
Signed-off-by: NGustavo A. R. Silva <garsilva@embeddedor.com>
Signed-off-by: NSamuel Ortiz <sameo@linux.intel.com>
上级 03036184
......@@ -482,8 +482,10 @@ static int __init nfcsim_init(void)
exit_err:
pr_err("Failed to initialize nfcsim driver (%d)\n", rc);
nfcsim_link_free(link0);
nfcsim_link_free(link1);
if (link0)
nfcsim_link_free(link0);
if (link1)
nfcsim_link_free(link1);
return rc;
}
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册