[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <CAHUa44FzAgGJHDB39ZWz=g9-RFCetPApYtDoHqpB-bngSHWwvA@mail.gmail.com>
Date: Tue, 30 Nov 2021 08:00:11 +0100
From: Jens Wiklander <jens.wiklander@...aro.org>
To: "Thomas, Rijo-john" <Rijo-john.Thomas@....com>
Cc: Dan Carpenter <dan.carpenter@...cle.com>,
Sumit Garg <sumit.garg@...aro.org>,
"Rangasamy, Devaraj" <Devaraj.Rangasamy@....com>,
Herbert Xu <herbert@...dor.apana.org.au>,
Gary R Hook <gary.hook@....com>,
"op-tee@...ts.trustedfirmware.org" <op-tee@...ts.trustedfirmware.org>,
"linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>,
"kernel-janitors@...r.kernel.org" <kernel-janitors@...r.kernel.org>
Subject: Re: [PATCH] tee: amdtee: fix an IS_ERR() vs NULL bug
On Mon, Nov 29, 2021 at 9:24 AM Thomas, Rijo-john
<Rijo-john.Thomas@....com> wrote:
>
> [Public]
>
> Acked-by: Rijo Thomas <Rijo-john.Thomas@....com>
>
> -----Original Message-----
> From: Dan Carpenter <dan.carpenter@...cle.com>
> Sent: Wednesday, November 24, 2021 8:24 PM
> To: Jens Wiklander <jens.wiklander@...aro.org>; Thomas, Rijo-john <Rijo-john.Thomas@....com>
> Cc: Sumit Garg <sumit.garg@...aro.org>; Rangasamy, Devaraj <Devaraj.Rangasamy@....com>; Herbert Xu <herbert@...dor.apana.org.au>; Gary R Hook <gary.hook@....com>; op-tee@...ts.trustedfirmware.org; linux-kernel@...r.kernel.org; kernel-janitors@...r.kernel.org
> Subject: [PATCH] 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@...cle.com>
> ---
> drivers/tee/amdtee/core.c | 5 ++---
> 1 file 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;
> }
Looks good, I'm picking up this.
Thanks,
Jens
Powered by blists - more mailing lists