summaryrefslogtreecommitdiff
path: root/drivers/tee
diff options
context:
space:
mode:
authorDan Carpenter <dan.carpenter@oracle.com>2021-11-24 17:54:04 +0300
committerJens Wiklander <jens.wiklander@linaro.org>2021-11-29 09:55:49 +0100
commit9d7482771fac8d8e38e763263f2ca0ca12dd22c6 (patch)
tree9436a0008cfedb595e4c63a6146831cc98111458 /drivers/tee
parentd58071a8a76d779eedab38033ae4c821c30295a5 (diff)
tee: amdtee: fix an IS_ERR() vs NULL bug
The __get_free_pages() function does not return error pointers it returns NULL so fix this condition to avoid a NULL dereference. Fixes: 757cc3e9ff1d ("tee: add AMD-TEE driver") Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com> Acked-by: Rijo Thomas <Rijo-john.Thomas@amd.com> Signed-off-by: Jens Wiklander <jens.wiklander@linaro.org>
Diffstat (limited to 'drivers/tee')
-rw-r--r--drivers/tee/amdtee/core.c5
1 files changed, 2 insertions, 3 deletions
diff --git a/drivers/tee/amdtee/core.c b/drivers/tee/amdtee/core.c
index da6b88e80dc0..297dc62bca29 100644
--- a/drivers/tee/amdtee/core.c
+++ b/drivers/tee/amdtee/core.c
@@ -203,9 +203,8 @@ static int copy_ta_binary(struct tee_context *ctx, void *ptr, void **ta,
*ta_size = roundup(fw->size, PAGE_SIZE);
*ta = (void *)__get_free_pages(GFP_KERNEL, get_order(*ta_size));
- if (IS_ERR(*ta)) {
- pr_err("%s: get_free_pages failed 0x%llx\n", __func__,
- (u64)*ta);
+ if (!*ta) {
+ pr_err("%s: get_free_pages failed\n", __func__);
rc = -ENOMEM;
goto rel_fw;
}