mirror of
https://github.com/torvalds/linux.git
synced 2024-11-11 06:31:49 +00:00
optee: fix kfree NULL pointer
This patch fixes the following Coccinelle error:
drivers/tee/optee/ffa_abi.c: 877: ERROR optee is NULL but dereferenced.
If memory allocation fails, optee is null pointer. the code will goto err
and release optee.
Fixes: 4615e5a34b
("optee: add FF-A support")
Reported-by: Zeal Robot <zealci@zte.com.cn>
Signed-off-by: Lv Ruyi <lv.ruyi@zte.com.cn>
Reviewed-by: Sumit Garg <sumit.garg@linaro.org>
[jw: removed the redundant braces]
Signed-off-by: Jens Wiklander <jens.wiklander@linaro.org>
This commit is contained in:
parent
fa55b7dcdc
commit
c23ca66a4d
@ -810,10 +810,9 @@ static int optee_ffa_probe(struct ffa_device *ffa_dev)
|
||||
return -EINVAL;
|
||||
|
||||
optee = kzalloc(sizeof(*optee), GFP_KERNEL);
|
||||
if (!optee) {
|
||||
rc = -ENOMEM;
|
||||
goto err;
|
||||
}
|
||||
if (!optee)
|
||||
return -ENOMEM;
|
||||
|
||||
optee->pool = optee_ffa_config_dyn_shm();
|
||||
if (IS_ERR(optee->pool)) {
|
||||
rc = PTR_ERR(optee->pool);
|
||||
|
Loading…
Reference in New Issue
Block a user