mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Philipp Zabel <p.zabel@pengutronix.de>
To: Jiasheng Jiang <jiasheng@iscas.ac.cn>, mchehab@kernel.org
Cc: linux-media@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH] media: coda: Add check for dcoda_iram_alloc
Date: Fri, 16 Dec 2022 18:32:09 +0100	[thread overview]
Message-ID: <354d17d2e1e55b12428fcb50f7cfce9bea81ea29.camel@pengutronix.de> (raw)
In-Reply-To: <20221117065652.44426-1-jiasheng@iscas.ac.cn>

On Do, 2022-11-17 at 14:56 +0800, Jiasheng Jiang wrote:
> As the coda_iram_alloc may return NULL pointer,

coda_iram_alloc() may return (phys_addr_t)0, not a NULL pointer.

> it should be better to check the return value
> in order to avoid NULL poineter dereference,
> same as the others.
> 
> Fixes: b313bcc9a467 ("[media] coda: simplify IRAM setup")
> Signed-off-by: Jiasheng Jiang <jiasheng@iscas.ac.cn>
> ---
>  drivers/media/platform/chips-media/coda-bit.c | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/media/platform/chips-media/coda-bit.c b/drivers/media/platform/chips-media/coda-bit.c
> index 2736a902e3df..6d816fd69a17 100644
> --- a/drivers/media/platform/chips-media/coda-bit.c
> +++ b/drivers/media/platform/chips-media/coda-bit.c
> @@ -854,7 +854,7 @@ static void coda_setup_iram(struct coda_ctx *ctx)
>  		/* Only H.264BP and H.263P3 are considered */
>  		iram_info->buf_dbk_y_use = coda_iram_alloc(iram_info, w64);

While this can return 0, if this allocation fails, ...

>  		iram_info->buf_dbk_c_use = coda_iram_alloc(iram_info, w64);

... this one must fail as well.

> -		if (!iram_info->buf_dbk_c_use)

So the buf_dbk_c_use check is enough.

regards
Philipp

      reply	other threads:[~2022-12-16 17:32 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-11-17  6:56 Jiasheng Jiang
2022-12-16 17:32 ` Philipp Zabel [this message]

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=354d17d2e1e55b12428fcb50f7cfce9bea81ea29.camel@pengutronix.de \
    --to=p.zabel@pengutronix.de \
    --cc=jiasheng@iscas.ac.cn \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-media@vger.kernel.org \
    --cc=mchehab@kernel.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

all inboxes | Powered by JetHome®