From: Ezequiel Garcia <ezequiel@vanguardiasur.com.ar>
To: Dong Chuanjian <chuanjian@nfschina.com>
Cc: mchehab@kernel.org, hverkuil-cisco@xs4all.nl,
nicolas.dufresne@collabora.com, sebastian.fricke@collabora.com,
linux-media@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH v2] drivers/media/v4l2-core/v4l2-h264 : add detection of null pointers
Date: Mon, 26 Dec 2022 18:22:05 -0300 [thread overview]
Message-ID: <Y6oQfdveBCZ/EWwI@eze-laptop> (raw)
In-Reply-To: <20221226070236.4450-1-chuanjian@nfschina.com>
Hi,
On Mon, Dec 26, 2022 at 03:02:36PM +0800, Dong Chuanjian wrote:
> When the pointer variable is judged to be null, null is returned
> directly.
>
> Signed-off-by: Dong Chuanjian <chuanjian@nfschina.com>
> ---
> v2: Directly return when pointer allocation fails.
>
> diff --git a/drivers/media/v4l2-core/v4l2-h264.c b/drivers/media/v4l2-core/v4l2-h264.c
> index 72bd64f65198..0e7b35ae3e94 100644
> --- a/drivers/media/v4l2-core/v4l2-h264.c
> +++ b/drivers/media/v4l2-core/v4l2-h264.c
> @@ -343,6 +343,8 @@ static const char *format_ref_list_b(const struct v4l2_h264_reflist_builder *bui
> int n = 0, i;
>
> *out_str = kmalloc(tmp_str_size, GFP_KERNEL);
> + if (*out_str == NULL)
> + return NULL;
>
format_ref_list_p has the same issue.
> n += snprintf(*out_str + n, tmp_str_size - n, "|");
>
> @@ -356,7 +358,6 @@ static const char *format_ref_list_b(const struct v4l2_h264_reflist_builder *bui
> longterm ? 'l' : 's',
> ref_type_to_char(reflist[i].fields));
> }
> -
Avoid spurious changes.
> return *out_str;
> }
>
> --
> 2.18.2
>
prev parent reply other threads:[~2022-12-26 21:22 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-12-26 7:02 [PATCH v2] drivers/media/v4l2-core/v4l2-h264 : add detection of null pointers Dong Chuanjian
2022-12-26 21:22 ` Ezequiel Garcia [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=Y6oQfdveBCZ/EWwI@eze-laptop \
--to=ezequiel@vanguardiasur.com.ar \
--cc=chuanjian@nfschina.com \
--cc=hverkuil-cisco@xs4all.nl \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-media@vger.kernel.org \
--cc=mchehab@kernel.org \
--cc=nicolas.dufresne@collabora.com \
--cc=sebastian.fricke@collabora.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