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 D1ECCA056B; Mon, 21 Nov 2022 21:41:17 +0100 (CET) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id D1AF442D5C; Mon, 21 Nov 2022 21:40:41 +0100 (CET) Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by mails.dpdk.org (Postfix) with ESMTP id 1CAEB42D44 for ; Mon, 21 Nov 2022 21:40:36 +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 E0485B815DE for ; Mon, 21 Nov 2022 20:40:35 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 53519C4347C; Mon, 21 Nov 2022 20:40:35 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1669063235; bh=0bFP7XEYzr+JImfIgc2FYAsJZrmD4Erj3hJvsOVmuLY=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=AU7gAb68lVgGPUJKd0VKfLAgJDan28n7oAKKRmG9RQgZXzU2B1uhnKmfUQuujYpBQ Ao8IW1glVAayPNRBEXMFkwkLY6RU8k92bgAy2kYuL087ifsnhIKhMr7g/UApwTUDvt KZ7YR3Tjk1XzjJsUQ98lLtIkXJLXVK/QbSHW7njxL2vW7vLfiArrXN5jsKVXPx7yd6 Xmo2SEDdZPGAxSoGKk59QF7e5fUPDA0cRfjhR8WZVKtZJ6sdYYMHp2r0Z95YX7g0Cm sGRcstwWqWi4UcMy7x/DBmNos3gb8NFVIIRUMVs91ep8M0Sldg8jnatyJ0nZEVtMnF 3okISkGNx2/FA== From: okaya@kernel.org To: dev@dpdk.org Cc: Sinan Kaya Subject: [PATCH 09/11] malloc: check result of malloc_elem_free Date: Mon, 21 Nov 2022 15:40:15 -0500 Message-Id: <20221121204015.1135573-10-okaya@kernel.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20221121204015.1135573-1-okaya@kernel.org> References: <20221121204015.1135573-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_free result of call to malloc_elem_free is dereferenced here and may be null. Signed-off-by: Sinan Kaya --- lib/eal/common/malloc_heap.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/lib/eal/common/malloc_heap.c b/lib/eal/common/malloc_heap.c index 1bf2e94c83..78a540c860 100644 --- a/lib/eal/common/malloc_heap.c +++ b/lib/eal/common/malloc_heap.c @@ -894,6 +894,9 @@ malloc_heap_free(struct malloc_elem *elem) /* anything after this is a bonus */ ret = 0; + if (!elem) + goto free_unlock; + /* ...of which we can't avail if we are in legacy mode, or if this is an * externally allocated segment. */ -- 2.25.1