From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from sclab-apps-2.localdomain (sc-fw1.tilera.com [12.218.212.162]) by dpdk.org (Postfix) with ESMTP id E94E0C92E for ; Fri, 19 Jun 2015 21:15:21 +0200 (CEST) X-CheckPoint: {55846A49-1-A3D4DA0C-C0000002} Received: by sclab-apps-2.localdomain (Postfix, from userid 1318) id 801E5220494; Fri, 19 Jun 2015 12:15:10 -0700 (PDT) From: Cyril Chemparathy To: dev@dpdk.org Date: Fri, 19 Jun 2015 12:15:02 -0700 Message-Id: <1434741309-22415-5-git-send-email-cchemparathy@ezchip.com> X-Mailer: git-send-email 2.1.2 In-Reply-To: <1434741309-22415-1-git-send-email-cchemparathy@ezchip.com> References: <1434741309-22415-1-git-send-email-cchemparathy@ezchip.com> Subject: [dpdk-dev] [PATCH 04/11] eal: allow empty compile time flags 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: Fri, 19 Jun 2015 19:15:31 -0000 The rte_cpu_check_supported() code breaks with a "comparison is always false due to limited range of data type" when the compile_time_flags[] array is empty. Assigning the array dimension to a local variable apparently solves this. Change-Id: I0ae21f529cf7b6dd9cf0f4532dce9198f4bf4230 Signed-off-by: Cyril Chemparathy --- lib/librte_eal/common/eal_common_cpuflags.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/lib/librte_eal/common/eal_common_cpuflags.c b/lib/librte_eal/common/eal_common_cpuflags.c index 6fd360c..8ba7b30 100644 --- a/lib/librte_eal/common/eal_common_cpuflags.c +++ b/lib/librte_eal/common/eal_common_cpuflags.c @@ -30,6 +30,7 @@ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ +#include #include /* @@ -62,10 +63,10 @@ rte_cpu_check_supported(void) static const enum rte_cpu_flag_t compile_time_flags[] = { RTE_COMPILE_TIME_CPUFLAGS }; - unsigned i; + unsigned count = RTE_DIM(compile_time_flags), i; int ret; - for (i = 0; i < sizeof(compile_time_flags)/sizeof(compile_time_flags[0]); i++) { + for (i = 0; i < count; i++) { ret = rte_cpu_get_flag_enabled(compile_time_flags[i]); if (ret < 0) { -- 2.1.2