From patchwork Tue Nov 22 15:30:47 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sinan Kaya X-Patchwork-Id: 120097 X-Patchwork-Delegate: thomas@monjalon.net Return-Path: X-Original-To: patchwork@inbox.dpdk.org Delivered-To: patchwork@inbox.dpdk.org Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id B0728A0582; Tue, 22 Nov 2022 16:31:25 +0100 (CET) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id EA4BB42D8B; Tue, 22 Nov 2022 16:31:02 +0100 (CET) Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by mails.dpdk.org (Postfix) with ESMTP id 50F1F42D7A for ; Tue, 22 Nov 2022 16:31:00 +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 ams.source.kernel.org (Postfix) with ESMTPS id 1858DB81BEB for ; Tue, 22 Nov 2022 15:31:00 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 04B2DC433C1; Tue, 22 Nov 2022 15:30:58 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1669131059; bh=e6AgEAXqwllsqVV5gZDAaE6+cqbUME7lx6SR302L8wA=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=htLm0olrL9sRLeJdBk0fFsvN29L0tuFYHG/Rthm/m7ttQwy9Rw/D4qoGBekB+zvdU 8EumwIuaPYzyjZ0UGNvNYqmUJ7XqklyjS5riHu6PV+DaqaI5+fEkMi/Unpni+eXdaN g/yqFdcVeFiJnrM6UeZkYymPhBgm3lJ7wDffajlVO6bAsv6qiwwofd0x1hz+pwycY0 85iHFZ2mUaH/FQhukZhWjmH+WsAuQkXrSC1+E3+rNgLOew1wG3NKUuziZ5A/aPLSz8 wwtn8bRVq0ZSLYTlw0OygTd1QNfacabgoYl6eksnr4kg5MRFldzwis9wC0i2yp9LG1 V+TRFKt/2WsRw== From: okaya@kernel.org To: dev@dpdk.org Cc: Sinan Kaya Subject: [PATCH RESEND v2 05/11] malloc: malloc_elem_join_adjacent_free can return null Date: Tue, 22 Nov 2022 10:30:47 -0500 Message-Id: <20221122153053.1172434-6-okaya@kernel.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20221122153053.1172434-1-okaya@kernel.org> References: <20221122153053.1172434-1-okaya@kernel.org> MIME-Version: 1.0 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);