From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-wm0-f66.google.com (mail-wm0-f66.google.com [74.125.82.66]) by dpdk.org (Postfix) with ESMTP id 62DC1201 for ; Tue, 24 Jan 2017 21:22:28 +0100 (CET) Received: by mail-wm0-f66.google.com with SMTP id r126so37350284wmr.3 for ; Tue, 24 Jan 2017 12:22:28 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id; bh=B3I9LXUpmk3A1azqfeebONUcIK4lQIZF7ffEullTcms=; b=W/P4QPSmhc7zmdo8/NL/X0LfccLgrqqtRv+U8LDDwcgPHgXUL6BUIBGYzRGTCJo+6o M6b33tFh8Nu5HCX1GSqhDqiiDwbagTYkvrdy8Vybb/YyUr5qWPdA8Jy9YnPtmzTAdcIp edW8UgjrbFwbjuWEDpnAptPV2WbDIPCcd/URNPQGaCIj3N+vuEkejcKa/ixforQpzSky J3lla3iFNbCt4OzGbXEy4yoRTVc8MOLwUJQvq8WPuoeKY7/pKikxObh9JIGp+NR1ca44 +1E40epi1wRMxhr/xoGDUUMjCctw2C3TWdJRLL5yCB+giIi7RncYQ4B8ljUbFIeAaDmW MEmw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id; bh=B3I9LXUpmk3A1azqfeebONUcIK4lQIZF7ffEullTcms=; b=YvXQBxifkQG18QkbyswJ+zkBC+4fSfkf2ZsifhZNYCGS+2o38orMjDzyhBXE8JjWmd xZqBNDiIP8y8/IJn1lOnaDmOgkS+96ur2kjJ2MBrFg/hwezlrL1rKK8/OOAxOkDKqi// n9926ktOuE1o5eGG7bQBeAdS4ZLZgM6PgrmVUSmdvliQVcIOYLnUBO2uPOlonAB+VVTV X5fkhlhpMS9zquYbUD+8Qw5iQu4TSJDKW7n9z6x2F+WAI2n8UFh7tKKIUvQgCPGceE2t Yp8NUoTEocCUVB9H3Rcdf71ncESoYl8pbdN8EBlELWHrRvsC7RPbS+hdwl3wqKjJcgJ5 TVAA== X-Gm-Message-State: AIkVDXJr/zhY3PAtzkxWeE9k6HeXkJt1Icur2D45jKEb0rpWPvYafJKajn0KfvhYfRO4PQ== X-Received: by 10.28.184.133 with SMTP id i127mr18302012wmf.49.1485289348105; Tue, 24 Jan 2017 12:22:28 -0800 (PST) Received: from emmanuel-Aspire-E5-571.primacom.net ([185.44.151.141]) by smtp.gmail.com with ESMTPSA id n10sm21567750wrb.9.2017.01.24.12.22.27 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Tue, 24 Jan 2017 12:22:27 -0800 (PST) From: Emmanuel Roullit To: david.marchand@6wind.com Cc: dev@dpdk.org Date: Tue, 24 Jan 2017 21:22:02 +0100 Message-Id: <20170124202202.31045-1-emmanuel.roullit@gmail.com> X-Mailer: git-send-email 2.11.0 Subject: [dpdk-dev] [PATCH] eal: fail eal when no hugepages were found X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 24 Jan 2017 20:22:28 -0000 Found with clang static analysis: lib/librte_eal/linuxapp/eal/eal_memory.c:1004:11: warning: Call to 'malloc' has an allocation size of 0 bytes tmp_hp = malloc(nr_hugepages * sizeof(struct hugepage_file)); ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ The --no-huge case, where nr_hugepages would be 0 as well, is handled earlier. Fixes: 5e823a451261 ("ethdev: remove some VF functions") Signed-off-by: Emmanuel Roullit --- lib/librte_eal/linuxapp/eal/eal_memory.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/lib/librte_eal/linuxapp/eal/eal_memory.c b/lib/librte_eal/linuxapp/eal/eal_memory.c index a956bb226..0b0355898 100644 --- a/lib/librte_eal/linuxapp/eal/eal_memory.c +++ b/lib/librte_eal/linuxapp/eal/eal_memory.c @@ -995,6 +995,9 @@ rte_eal_hugepage_init(void) nr_hugepages += internal_config.hugepage_info[i].num_pages[0]; } + if (nr_hugepages == 0) + goto fail; + /* * allocate a memory area for hugepage table. * this isn't shared memory yet. due to the fact that we need some -- 2.11.0