From: David Laight <David.Laight@ACULAB.COM>
To: 'Jens Wiklander' <jens.wiklander@linaro.org>,
"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
"op-tee@lists.trustedfirmware.org"
<op-tee@lists.trustedfirmware.org>
Cc: Sumit Garg <sumit.garg@linaro.org>
Subject: RE: [PATCH] optee: add error checks in optee_ffa_do_call_with_arg()
Date: Wed, 19 Jan 2022 14:18:03 +0000 [thread overview]
Message-ID: <bf3c1583f8d7466a96bab8feb462bb36@AcuMS.aculab.com> (raw)
In-Reply-To: <20220119080736.2940906-1-jens.wiklander@linaro.org>
From: Jens Wiklander
> Sent: 19 January 2022 08:08
>
> Adds error checking in optee_ffa_do_call_with_arg() for correctness.
>
> Fixes: 4615e5a34b95 ("optee: add FF-A support")
> Signed-off-by: Jens Wiklander <jens.wiklander@linaro.org>
> ---
> drivers/tee/optee/ffa_abi.c | 15 ++++++++++++---
> 1 file changed, 12 insertions(+), 3 deletions(-)
>
> diff --git a/drivers/tee/optee/ffa_abi.c b/drivers/tee/optee/ffa_abi.c
> index d8c8683863aa..d88bd2e41572 100644
> --- a/drivers/tee/optee/ffa_abi.c
> +++ b/drivers/tee/optee/ffa_abi.c
> @@ -619,9 +619,18 @@ static int optee_ffa_do_call_with_arg(struct tee_context *ctx,
> .data2 = (u32)(shm->sec_world_id >> 32),
> .data3 = shm->offset,
> };
> - struct optee_msg_arg *arg = tee_shm_get_va(shm, 0);
> - unsigned int rpc_arg_offs = OPTEE_MSG_GET_ARG_SIZE(arg->num_params);
> - struct optee_msg_arg *rpc_arg = tee_shm_get_va(shm, rpc_arg_offs);
> + struct optee_msg_arg *arg;
> + unsigned int rpc_arg_offs;
> + struct optee_msg_arg *rpc_arg;
> +
> + arg = tee_shm_get_va(shm, 0);
> + if (IS_ERR(arg))
> + return PTR_ERR(arg);
> +
> + rpc_arg_offs = OPTEE_MSG_GET_ARG_SIZE(arg->num_params);
> + rpc_arg = tee_shm_get_va(shm, rpc_arg_offs);
> + if (IS_ERR(arg))
> + return PTR_ERR(arg);
What's this duplicate test for?
David
-
Registered Address Lakeside, Bramley Road, Mount Farm, Milton Keynes, MK1 1PT, UK
Registration No: 1397386 (Wales)
next prev parent reply other threads:[~2022-01-19 14:18 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-01-19 8:07 Jens Wiklander
2022-01-19 14:18 ` David Laight [this message]
2022-01-20 7:16 ` Jens Wiklander
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=bf3c1583f8d7466a96bab8feb462bb36@AcuMS.aculab.com \
--to=david.laight@aculab.com \
--cc=jens.wiklander@linaro.org \
--cc=linux-kernel@vger.kernel.org \
--cc=op-tee@lists.trustedfirmware.org \
--cc=sumit.garg@linaro.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
Powered by JetHome