From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-wg0-f45.google.com (mail-wg0-f45.google.com [74.125.82.45]) by dpdk.org (Postfix) with ESMTP id C0281AFD2 for ; Tue, 15 Apr 2014 15:51:07 +0200 (CEST) Received: by mail-wg0-f45.google.com with SMTP id l18so9431317wgh.28 for ; Tue, 15 Apr 2014 06:51:08 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=qklODj0uRQGzGxbNeCEXjdUjNRlkI/ClD0LAKGxJJ2k=; b=havegtjRdQ4mJMc91gczCgXT4TOHI3naxx09bYGns4udGKd86JFe7+mQ5Y32Zu4mta RbvyW2ZCoel/zGmtBMvAPUKezsRjPrzKzIq3qKc/5f4Yav8QXw45CBmOQatvlw9unWXz J6+TNcIsCPwzowP/vZhgbJh4gb0wwB8wke6g64PynPIeCwOt7d76oHGv/yElmR/BHoww iDyjIt7nzCw+fy7EC0VAnN/pdM8b3vF8xtS8HEHps0TMJ0UvfIvsMpwHGJaPSQS60ktS d3/jKpY8DRM7Jbjv4J28ytWYX6zvFEx33a2PCm6oqoNTOoJJZeEwXEPYBrFoUgIOfZdC 5tTQ== X-Gm-Message-State: ALoCoQlJR1WtZVOa2vx5VQE67S65jHUvy4QZG9KutAzxxJBTOFqoJl+ix9kC45+w57OkMFjfGthn X-Received: by 10.194.109.6 with SMTP id ho6mr1771759wjb.21.1397569868127; Tue, 15 Apr 2014 06:51:08 -0700 (PDT) Received: from alcyon.dev.6wind.com (6wind.net2.nerim.net. [213.41.180.237]) by mx.google.com with ESMTPSA id co9sm29827177wjb.22.2014.04.15.06.51.06 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 15 Apr 2014 06:51:07 -0700 (PDT) From: David Marchand To: dev@dpdk.org Date: Tue, 15 Apr 2014 15:50:59 +0200 Message-Id: <1397569859-14460-2-git-send-email-david.marchand@6wind.com> X-Mailer: git-send-email 1.7.10.4 In-Reply-To: <1397569859-14460-1-git-send-email-david.marchand@6wind.com> References: <1397569859-14460-1-git-send-email-david.marchand@6wind.com> Subject: [dpdk-dev] [PATCH 2/2] mem: fix initialization check for malloc heap X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: patches and discussions about DPDK List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 15 Apr 2014 13:51:08 -0000 From: Didier Pallard initialised field must be checked against INITIALISED value before allowing malloc to occur, else some core may pass the test and start malloc while heap is in INITIALISING state and is not fully initialized. Signed-off-by: Didier Pallard --- lib/librte_malloc/malloc_heap.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/librte_malloc/malloc_heap.c b/lib/librte_malloc/malloc_heap.c index 64668cb..eed8a63 100644 --- a/lib/librte_malloc/malloc_heap.c +++ b/lib/librte_malloc/malloc_heap.c @@ -197,7 +197,7 @@ void * malloc_heap_alloc(struct malloc_heap *heap, const char *type __attribute__((unused)), size_t size, unsigned align) { - if (!heap->initialised) + if (heap->initialised != INITIALISED) malloc_heap_init(heap); size = CACHE_LINE_ROUNDUP(size); @@ -227,7 +227,7 @@ int malloc_heap_get_stats(const struct malloc_heap *heap, struct rte_malloc_socket_stats *socket_stats) { - if (!heap->initialised) + if (heap->initialised != INITIALISED) return -1; struct malloc_elem *elem = heap->free_head; -- 1.7.10.4