From: Bagas Sanjaya <bagasdotme@gmail.com>
To: Li kunyu <kunyu@nfschina.com>
Cc: krisman@collabora.com, linux-fsdevel@vger.kernel.org,
linux-kernel@vger.kernel.org
Subject: Re: [PATCH 2/2] unicode: mkutf8data: Add malloc allocation check
Date: Mon, 24 Oct 2022 14:59:15 +0700 [thread overview]
Message-ID: <Y1ZF040OJaJ31doE@debian.me> (raw)
In-Reply-To: <20221024045150.177521-1-kunyu@nfschina.com>
[-- Attachment #1: Type: text/plain, Size: 942 bytes --]
On Mon, Oct 24, 2022 at 12:51:50PM +0800, Li kunyu wrote:
> Increase the judgment of malloc allocation, and return NULL if the
> condition is met.
>
> Signed-off-by: Li kunyu <kunyu@nfschina.com>
> ---
> fs/unicode/mkutf8data.c | 3 +++
> 1 file changed, 3 insertions(+)
>
> diff --git a/fs/unicode/mkutf8data.c b/fs/unicode/mkutf8data.c
> index e06404a6b106..a929ddf1438c 100644
> --- a/fs/unicode/mkutf8data.c
> +++ b/fs/unicode/mkutf8data.c
> @@ -495,6 +495,9 @@ static struct node *alloc_node(struct node *parent)
> int bitnum;
>
> node = malloc(sizeof(*node));
> + if (!node)
> + return NULL;
> +
> node->left = node->right = NULL;
> node->parent = parent;
> node->leftnode = NODE;
What?
This is not "malloc judgement", but rather return NULL if node fails to
allocate.
Please, please reword the patch description.
Thanks.
--
An old man doll... just what I always wanted! - Clara
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 228 bytes --]
prev parent reply other threads:[~2022-10-24 7:59 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-10-24 4:51 [PATCH 2/2] unicode: mkutf8data: Add malloc allocation check Li kunyu
2022-10-24 7:59 ` 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=Y1ZF040OJaJ31doE@debian.me \
--to=bagasdotme@gmail.com \
--cc=krisman@collabora.com \
--cc=kunyu@nfschina.com \
--cc=linux-fsdevel@vger.kernel.org \
--cc=linux-kernel@vger.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;
as well as URLs for NNTP newsgroup(s).