mail archive of the barebox mailing list
 help / color / mirror / Atom feed
From: Marco Felsch <m.felsch@pengutronix.de>
To: Ahmad Fatoum <a.fatoum@pengutronix.de>
Cc: barebox@lists.infradead.org
Subject: Re: [PATCH master] optee: check optee_verify_header argument for error pointers
Date: Thu, 29 Feb 2024 12:08:46 +0100	[thread overview]
Message-ID: <20240229110846.zxumzudpnqqtyezk@pengutronix.de> (raw)
In-Reply-To: <20240229094655.2897860-1-a.fatoum@pengutronix.de>

On 24-02-29, Ahmad Fatoum wrote:
> optee_verify_header is called at two places with
> imx_scratch_get_optee_hdr() as argument, which returns an error pointer.
> 
> Check against that to avoid crashing in error cases.
> 
> Suggested-by: Marco Felsch <m.felsch@pengutronix.de>
> Signed-off-by: Ahmad Fatoum <a.fatoum@pengutronix.de>

Reviewed-by: Marco Felsch <m.felsch@pengutronix.de>

> ---
>  common/optee.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/common/optee.c b/common/optee.c
> index a8a43554e757..7fe93e441974 100644
> --- a/common/optee.c
> +++ b/common/optee.c
> @@ -10,7 +10,7 @@ static u64 optee_membase = U64_MAX;
>  
>  int optee_verify_header(const struct optee_header *hdr)
>  {
> -	if (!hdr)
> +	if (IS_ERR_OR_NULL(hdr))
>  		return -EINVAL;
>  
>  	if (hdr->magic != OPTEE_MAGIC) {
> -- 
> 2.39.2
> 
> 



  reply	other threads:[~2024-02-29 11:09 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-02-29  9:46 Ahmad Fatoum
2024-02-29 11:08 ` Marco Felsch [this message]
2024-03-01  9:20 ` Sascha Hauer

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=20240229110846.zxumzudpnqqtyezk@pengutronix.de \
    --to=m.felsch@pengutronix.de \
    --cc=a.fatoum@pengutronix.de \
    --cc=barebox@lists.infradead.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