event/dpaa: fix integer overflow of max ports
authorGowrishankar Muthukrishnan <gowrishankar.m@linux.vnet.ibm.com>
Fri, 13 Apr 2018 05:06:31 +0000 (10:36 +0530)
committerThomas Monjalon <thomas@monjalon.net>
Mon, 16 Apr 2018 14:45:11 +0000 (16:45 +0200)
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.

drivers/event/dpaa/dpaa_eventdev.c: In function ‘dpaa_event_dev_info_get’:
   rte_config.h:23:23: error:
   large integer implicitly truncated to unsigned type [-Werror=overflow]
      #define RTE_MAX_LCORE 256

Fixes: 9caac5dd1e ("event/dpaa: introduce PMD")
Cc: stable@dpdk.org
Signed-off-by: Gowrishankar Muthukrishnan <gowrishankar.m@linux.vnet.ibm.com>
Acked-by: Sunil Kumar Kori <sunil.kori@nxp.com>
drivers/event/dpaa/dpaa_eventdev.h

index 918fe35..583e46c 100644 (file)
@@ -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)