From mboxrd@z Thu Jan 1 00:00:00 1970 From: Gowrishankar Subject: [PATCH] event/dpaa: fix integer overflow on max_event_ports at compile time Date: Fri, 13 Apr 2018 10:36:31 +0530 Message-ID: <1103cd020ba0357f46650c6de1807cbf35d2a83c.1523595512.git.gowrishankar.m@linux.vnet.ibm.com> Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Anatoly Burakov , dev@dpdk.org, Thomas Monjalon , Gowrishankar Muthukrishnan To: Sunil Kumar Kori , Shreyansh Jain Return-path: Received: from mx0a-001b2d01.pphosted.com (mx0b-001b2d01.pphosted.com [148.163.158.5]) by dpdk.org (Postfix) with ESMTP id 419881B705 for ; Fri, 13 Apr 2018 07:06:40 +0200 (CEST) Received: from pps.filterd (m0098420.ppops.net [127.0.0.1]) by mx0b-001b2d01.pphosted.com (8.16.0.22/8.16.0.22) with SMTP id w3D56Fte041711 for ; Fri, 13 Apr 2018 01:06:39 -0400 Received: from e06smtp14.uk.ibm.com (e06smtp14.uk.ibm.com [195.75.94.110]) by mx0b-001b2d01.pphosted.com with ESMTP id 2hanbsscs0-1 (version=TLSv1.2 cipher=AES256-SHA256 bits=256 verify=NOT) for ; Fri, 13 Apr 2018 01:06:39 -0400 Received: from localhost by e06smtp14.uk.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Fri, 13 Apr 2018 06:06:37 +0100 List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org Sender: "dev" From: Gowrishankar Muthukrishnan dev_info->max_event_ports is uint8_t. dpaa_event_dev_info_get assigns DPAA_EVENT_MAX_EVENT_PORT (which is RTE_MAX_LCORE, upto 256 in ppc64le) into this variable, which breaks compile in ppc64le. Fixes: 9caac5dd1e ("event/dpaa: introduce PMD") Signed-off-by: Gowrishankar Muthukrishnan -- dpdk/drivers/event/dpaa/dpaa_eventdev.c: In function ‘dpaa_event_dev_info_get’: dpdk/ppc_64-power8-linuxapp-gcc/include/rte_config.h:23:23: error: large integer implicitly truncated to unsigned type [-Werror=overflow] #define RTE_MAX_LCORE 256 ^ dpdk/drivers/event/dpaa/dpaa_eventdev.h:29:36: note: in expansion of macro ‘RTE_MAX_LCORE’ #define DPAA_EVENT_MAX_EVENT_PORT RTE_MAX_LCORE ^~~~~~~~~~~~~ dpdk/drivers/event/dpaa/dpaa_eventdev.c:197:3: note: in expansion of macro ‘DPAA_EVENT_MAX_EVENT_PORT’ DPAA_EVENT_MAX_EVENT_PORT; ^~~~~~~~~~~~~~~~~~~~~~~~~ drivers/event/dpaa/dpaa_eventdev.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/event/dpaa/dpaa_eventdev.h b/drivers/event/dpaa/dpaa_eventdev.h index 918fe35..583e46c 100644 --- a/drivers/event/dpaa/dpaa_eventdev.h +++ b/drivers/event/dpaa/dpaa_eventdev.h @@ -26,7 +26,7 @@ #define DPAA_EVENT_MAX_QUEUE_FLOWS 2048 #define DPAA_EVENT_MAX_QUEUE_PRIORITY_LEVELS 8 #define DPAA_EVENT_MAX_EVENT_PRIORITY_LEVELS 0 -#define DPAA_EVENT_MAX_EVENT_PORT RTE_MAX_LCORE +#define DPAA_EVENT_MAX_EVENT_PORT RTE_MIN(RTE_MAX_LCORE, INT8_MAX) #define DPAA_EVENT_MAX_PORT_DEQUEUE_DEPTH 8 #define DPAA_EVENT_PORT_DEQUEUE_TIMEOUT_NS 100UL #define DPAA_EVENT_PORT_DEQUEUE_TIMEOUT_INVALID ((uint64_t)-1) -- 1.9.1