From nobody Wed Apr 8 06:45:17 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id EB344ECDFA1 for ; Mon, 24 Oct 2022 08:34:59 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229939AbiJXIe5 (ORCPT ); Mon, 24 Oct 2022 04:34:57 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:52170 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230336AbiJXIeq (ORCPT ); Mon, 24 Oct 2022 04:34:46 -0400 Received: from mail.nfschina.com (mail.nfschina.com [124.16.136.209]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id 5C6C82AE1B; Mon, 24 Oct 2022 01:34:44 -0700 (PDT) Received: from localhost (unknown [127.0.0.1]) by mail.nfschina.com (Postfix) with ESMTP id 45CC81E80D74; Mon, 24 Oct 2022 16:28:59 +0800 (CST) X-Virus-Scanned: amavisd-new at test.com Received: from mail.nfschina.com ([127.0.0.1]) by localhost (mail.nfschina.com [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id gWT6Xz_bwSwN; Mon, 24 Oct 2022 16:28:56 +0800 (CST) Received: from localhost.localdomain (unknown [219.141.250.2]) (Authenticated sender: kunyu@nfschina.com) by mail.nfschina.com (Postfix) with ESMTPA id 958F71E80CA5; Mon, 24 Oct 2022 16:28:56 +0800 (CST) From: Li kunyu To: krisman@collabora.com Cc: linux-fsdevel@vger.kernel.org, linux-kernel@vger.kernel.org, Li kunyu Subject: [PATCH] unicode: mkutf8data: Add malloc allocation check Date: Mon, 24 Oct 2022 16:30:07 +0800 Message-Id: <20221024083007.179093-1-kunyu@nfschina.com> X-Mailer: git-send-email 2.18.2 Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" If malloc allocation fails, NULL is returned. Signed-off-by: Li kunyu --- 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; =20 node =3D malloc(sizeof(*node)); + if (!node) + return NULL; + node->left =3D node->right =3D NULL; node->parent =3D parent; node->leftnode =3D NODE; --=20 2.18.2