From: Hans Verkuil <hverkuil@xs4all.nl>
To: Jiasheng Jiang <jiasheng@iscas.ac.cn>,
narmstrong@baylibre.com, mchehab@kernel.org,
gregkh@linuxfoundation.org, khilman@baylibre.com,
jbrunet@baylibre.com, martin.blumenstingl@googlemail.com
Cc: linux-media@vger.kernel.org, linux-amlogic@lists.infradead.org,
linux-staging@lists.linux.dev,
linux-arm-kernel@lists.infradead.org,
linux-kernel@vger.kernel.org
Subject: Re: [PATCH] media: meson: vdec: potential dereference of null pointer
Date: Thu, 9 Dec 2021 12:58:45 +0100 [thread overview]
Message-ID: <bfd1801c-9d1e-0574-a237-711d3d5ae755@xs4all.nl> (raw)
In-Reply-To: <20211209085840.2081024-1-jiasheng@iscas.ac.cn>
On 09/12/2021 09:58, Jiasheng Jiang wrote:
> he return value of kzalloc() needs to be checked.
> To avoid use of null pointer in case of the failure of alloc.
>
> Fixes: 876f123b8956 ("media: meson: vdec: bring up to compliance")
> Signed-off-by: Jiasheng Jiang <jiasheng@iscas.ac.cn>
> ---
> drivers/staging/media/meson/vdec/vdec_helpers.c | 2 ++
> 1 file changed, 2 insertions(+)
>
> diff --git a/drivers/staging/media/meson/vdec/vdec_helpers.c b/drivers/staging/media/meson/vdec/vdec_helpers.c
> index 7f07a9175815..025885fcfec6 100644
> --- a/drivers/staging/media/meson/vdec/vdec_helpers.c
> +++ b/drivers/staging/media/meson/vdec/vdec_helpers.c
> @@ -234,6 +234,8 @@ void amvdec_add_ts(struct amvdec_session *sess, u64 ts,
> unsigned long flags;
>
> new_ts = kzalloc(sizeof(*new_ts), GFP_KERNEL);
> + if (!new_ts)
> + return;
While this avoids dereferencing a NULL pointer, this error isn't propagated to the
caller. And I'm not sure if that's right.
Neil, what should be done in this case?
Regards,
Hans
> new_ts->ts = ts;
> new_ts->tc = tc;
> new_ts->offset = offset;
>
_______________________________________________
linux-amlogic mailing list
linux-amlogic@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-amlogic
next prev parent reply other threads:[~2021-12-09 11:59 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-12-09 8:58 Jiasheng Jiang
2021-12-09 11:58 ` Hans Verkuil [this message]
2021-12-09 17:52 ` Neil Armstrong
2022-01-13 6:56 Jiasheng Jiang
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=bfd1801c-9d1e-0574-a237-711d3d5ae755@xs4all.nl \
--to=hverkuil@xs4all.nl \
--cc=gregkh@linuxfoundation.org \
--cc=jbrunet@baylibre.com \
--cc=jiasheng@iscas.ac.cn \
--cc=khilman@baylibre.com \
--cc=linux-amlogic@lists.infradead.org \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-media@vger.kernel.org \
--cc=linux-staging@lists.linux.dev \
--cc=martin.blumenstingl@googlemail.com \
--cc=mchehab@kernel.org \
--cc=narmstrong@baylibre.com \
/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®