From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id 8EDAA4242A; Fri, 20 Jan 2023 05:42:18 +0100 (CET) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 9A82E42DB8; Fri, 20 Jan 2023 05:41:57 +0100 (CET) Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by mails.dpdk.org (Postfix) with ESMTP id 1A64642D14 for ; Fri, 20 Jan 2023 05:41:53 +0100 (CET) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 9445861E05; Fri, 20 Jan 2023 04:41:52 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 1278CC433F0; Fri, 20 Jan 2023 04:41:51 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1674189712; bh=e6AgEAXqwllsqVV5gZDAaE6+cqbUME7lx6SR302L8wA=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=VwjJ4tV8sKcwM0vql26CN1Wy9kXUffk28SRE+gXfGdjCBlSWdG7dfER1bxSxLp4b3 cX1YFUEYUvPo1FDQ+IEl82h99cdFzRWTGvrm0+TL13R4tqvmtXwqdS1JBvx+Zdx0+J zMs4nKqA+PeFBxwMC9JcE/r8t5L5WoTTO5D0z24P/jfBjqXWoVxsah4iaURX2u3Zw5 Fb24a7zdVlxq43y3TMi/PhKqB0SHlGcTF+CXILKRP/c//ykH/SkZV7BWxr7M1zjx0D ZzkiB43Da6XcOPfZQUk3h+O0MK16yd25835xs6hZHCMYkp7d0CMfRhIk5Hyqa3bglW aCf25aBEMmL8g== From: okaya@kernel.org To: Anatoly Burakov Cc: dev@dpdk.org, Sinan Kaya Subject: [PATCH v3 04/10] malloc: malloc_elem_join_adjacent_free can return null Date: Thu, 19 Jan 2023 23:41:34 -0500 Message-Id: <20230120044140.95975-5-okaya@kernel.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20230120044140.95975-1-okaya@kernel.org> References: <20230120044140.95975-1-okaya@kernel.org> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org From: Sinan Kaya In malloc_heap_add_memory result of call to malloc_elem_join_adjacent_free is dereferenced here and may be null. Signed-off-by: Sinan Kaya --- lib/eal/common/malloc_heap.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/lib/eal/common/malloc_heap.c b/lib/eal/common/malloc_heap.c index d7c410b786..503e551bf9 100644 --- a/lib/eal/common/malloc_heap.c +++ b/lib/eal/common/malloc_heap.c @@ -97,6 +97,8 @@ malloc_heap_add_memory(struct malloc_heap *heap, struct rte_memseg_list *msl, malloc_elem_insert(elem); elem = malloc_elem_join_adjacent_free(elem); + if (elem == NULL) + return NULL; malloc_elem_free_list_insert(elem); -- 2.25.1