[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-Id: <20221024045150.177521-1-kunyu@nfschina.com>
Date: Mon, 24 Oct 2022 12:51:50 +0800
From: Li kunyu <kunyu@...china.com>
To: krisman@...labora.com
Cc: linux-fsdevel@...r.kernel.org, linux-kernel@...r.kernel.org,
Li kunyu <kunyu@...china.com>
Subject: [PATCH 2/2] unicode: mkutf8data: Add malloc allocation check
Increase the judgment of malloc allocation, and return NULL if the
condition is met.
Signed-off-by: Li kunyu <kunyu@...china.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;
--
2.18.2
Powered by blists - more mailing lists