All of lore.kernel.org
 help / color / mirror / Atom feed
From: Bagas Sanjaya <bagasdotme@gmail.com>
To: Li zeming <zeming@nfschina.com>,
	mchehab@kernel.org, hverkuil-cisco@xs4all.nl,
	nicolas.dufresne@collabora.com
Cc: linux-media@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH] v4l2-core: v4l2-h264: check after increasing memory allocation
Date: Mon, 19 Dec 2022 14:41:07 +0700	[thread overview]
Message-ID: <Y6AVkwh+V/PjzIfK@debian.me> (raw)
In-Reply-To: <20221219033712.3270-1-zeming@nfschina.com>

[-- Attachment #1: Type: text/plain, Size: 775 bytes --]

On Mon, Dec 19, 2022 at 11:37:12AM +0800, Li zeming wrote:
> The pointer *out_str adds judgment and should help with program robustness.
> 

Terminology: if[-else] blocks are conditionals, not judgements.

> diff --git a/drivers/media/v4l2-core/v4l2-h264.c b/drivers/media/v4l2-core/v4l2-h264.c
> index 72bd64f65198..934aba539332 100644
> --- a/drivers/media/v4l2-core/v4l2-h264.c
> +++ b/drivers/media/v4l2-core/v4l2-h264.c
> @@ -305,6 +305,8 @@ static const char *format_ref_list_p(const struct v4l2_h264_reflist_builder *bui
>  	int n = 0, i;
>  
>  	*out_str = kmalloc(tmp_str_size, GFP_KERNEL);
> +	if (!*out_str)
> +		return NULL;

Why did you add the check beside robustness?

Thanks. 

-- 
An old man doll... just what I always wanted! - Clara

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 228 bytes --]

      reply	other threads:[~2022-12-19  7:41 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-12-19  3:37 [PATCH] v4l2-core: v4l2-h264: check after increasing memory allocation Li zeming
2022-12-19  7:41 ` Bagas Sanjaya [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=Y6AVkwh+V/PjzIfK@debian.me \
    --to=bagasdotme@gmail.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=zeming@nfschina.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.