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 9CBB1A0582; Tue, 22 Nov 2022 16:31:37 +0100 (CET) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id A857942D94; Tue, 22 Nov 2022 16:31:04 +0100 (CET) Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by mails.dpdk.org (Postfix) with ESMTP id 6944642D85 for ; Tue, 22 Nov 2022 16:31:01 +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 E5C2C61753 for ; Tue, 22 Nov 2022 15:31:00 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 0F775C43470; Tue, 22 Nov 2022 15:30:59 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1669131060; bh=OA9aKvIimBSPp+xtTJJVhYWAQ4KuSadN9gXKHvpeV1w=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=rNn/acZhi4H78XDj+H3tCqSjYSqrlbMbaDIkdlXsow4nkVcDJ6TQxAWi1Oi9YDHNx iar/l3+xUkmWJcK5ZHC0hjtj5ZhZ/a6PnxoBdrRciNmKHGzmCR4qL4bIq0kMyg6PKq 2rOTowmi0XMHjq+j7i6JgTNFBpYxTRKZzqxMX9LknjfME18QEBszUodLw9GUfjhtS9 94Yoazw32ueKo8Xm6WdQsO+oEOBZbYAou/JD1mEH90u6G2ZNX/Z2kbP5JS9F3SKo96 qNpHeAuTZT/afHUzWqlaFPZCD472LoglI1En9rPznC39L0IzSG+lmfat8Gbnn2aW2P Gpm53PIDsiU/A== From: okaya@kernel.org To: dev@dpdk.org Cc: Sinan Kaya Subject: [PATCH RESEND v2 06/11] malloc: check result of rte_mem_virt2memseg_list Date: Tue, 22 Nov 2022 10:30:48 -0500 Message-Id: <20221122153053.1172434-7-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 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 alloc_pages_on_heap result of call to rte_mem_virt2memseg_list 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 503e551bf9..3f41430e42 100644 --- a/lib/eal/common/malloc_heap.c +++ b/lib/eal/common/malloc_heap.c @@ -323,6 +323,8 @@ alloc_pages_on_heap(struct malloc_heap *heap, uint64_t pg_sz, size_t elt_size, map_addr = ms[0]->addr; msl = rte_mem_virt2memseg_list(map_addr); + if (msl == NULL) + return NULL; /* check if we wanted contiguous memory but didn't get it */ if (contig && !eal_memalloc_is_contig(msl, map_addr, alloc_sz)) { -- 2.25.1