[dpdk-dev,v3,37/40] rte_ethdev.h: explicit cast for truncation

Message ID 152592056533.119328.12664018487579193844.stgit@localhost.localdomain (mailing list archive)
State Superseded, archived
Headers

Checks

Context Check Description
ci/checkpatch success coding style OK
ci/Intel-compilation success Compilation OK

Commit Message

Andy Green May 10, 2018, 2:49 a.m. UTC
  /projects/lagopus/src/dpdk/build/include/rte_ethdev.h:
In function 'rte_eth_tx_buffer_flush':
/projects/lagopus/src/dpdk/build/include/rte_ethdev.h:4248:55:
warning: conversion from 'int' to 'uint16_t'
{aka 'short unsigned int'} may change value [-Wconversion]
   buffer->error_callback(&buffer->pkts[sent], to_send - sent,

Signed-off-by: Andy Green <andy@warmcat.com>
---
 lib/librte_ethdev/rte_ethdev.h |    5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)
  

Patch

diff --git a/lib/librte_ethdev/rte_ethdev.h b/lib/librte_ethdev/rte_ethdev.h
index c84dc44b8..a7c0b3025 100644
--- a/lib/librte_ethdev/rte_ethdev.h
+++ b/lib/librte_ethdev/rte_ethdev.h
@@ -4245,8 +4245,9 @@  rte_eth_tx_buffer_flush(uint16_t port_id, uint16_t queue_id,
 
 	/* All packets sent, or to be dealt with by callback below */
 	if (unlikely(sent != to_send))
-		buffer->error_callback(&buffer->pkts[sent], to_send - sent,
-				buffer->error_userdata);
+		buffer->error_callback(&buffer->pkts[sent],
+				       (uint16_t)(to_send - sent),
+				       buffer->error_userdata);
 
 	return sent;
 }