From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from szxga08-in.huawei.com (szxga08-in.huawei.com [45.249.212.255]) by sourceware.org (Postfix) with ESMTPS id 9DFC93858422 for ; Fri, 4 Nov 2022 09:28:02 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 9DFC93858422 Authentication-Results: sourceware.org; dmarc=pass (p=quarantine dis=none) header.from=huawei.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=huawei.com Received: from canpemm500006.china.huawei.com (unknown [172.30.72.55]) by szxga08-in.huawei.com (SkyGuard) with ESMTP id 4N3ZzY0Czrz15MNF; Fri, 4 Nov 2022 17:27:53 +0800 (CST) Received: from use12-sp2.huawei.com (10.67.189.174) by canpemm500006.china.huawei.com (7.192.105.130) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2375.31; Fri, 4 Nov 2022 17:27:58 +0800 From: Xiaoming Ni To: , , CC: , , Subject: [PATCH] elf/tlsdeschtab.h: Add the Malloc return value check in _dl_make_tlsdesc_dynamic() Date: Fri, 4 Nov 2022 17:30:00 +0800 Message-ID: <20221104093000.25169-1-nixiaoming@huawei.com> X-Mailer: git-send-email 2.27.0 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Content-Type: text/plain X-Originating-IP: [10.67.189.174] X-ClientProxiedBy: dggems704-chm.china.huawei.com (10.3.19.181) To canpemm500006.china.huawei.com (7.192.105.130) X-CFilter-Loop: Reflected X-Spam-Status: No, score=-13.5 required=5.0 tests=BAYES_00,GIT_PATCH_0,KAM_DMARC_STATUS,SPF_HELO_NONE,SPF_PASS,TXREP autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org List-Id: Check the return value of malloc based on the function header comment of _dl_make_tlsdesc_dynamic(). If the return value fails, NULL is returned. Signed-off-by: Xiaoming Ni --- elf/tlsdeschtab.h | 2 ++ 1 file changed, 2 insertions(+) diff --git a/elf/tlsdeschtab.h b/elf/tlsdeschtab.h index 8c02e45a49..82733159e3 100644 --- a/elf/tlsdeschtab.h +++ b/elf/tlsdeschtab.h @@ -110,6 +110,8 @@ _dl_make_tlsdesc_dynamic (struct link_map *map, size_t ti_offset) } *entry = td = malloc (sizeof (struct tlsdesc_dynamic_arg)); + if (! td) + return 0; /* This may be higher than the map's generation, but it doesn't matter much. Worst case, we'll have one extra DTV update per thread. */ -- 2.27.0