DPDK patches and discussions
 help / color / mirror / Atom feed
* [dpdk-dev] [PATCH] vhost/crypto: fix build issue with GCC 4.7.2
@ 2018-04-27  9:04 Maxime Coquelin
  2018-04-27  9:25 ` Thomas Monjalon
  0 siblings, 1 reply; 2+ messages in thread
From: Maxime Coquelin @ 2018-04-27  9:04 UTC (permalink / raw)
  To: dev, jianfeng.tan, thomas, roy.fan.zhang; +Cc: Maxime Coquelin

Build error has been reported by Intel build system:
SUSE12SP3_64 / Linux 3.7.10-1 / GCC 4.7.2
lib/librte_vhost/vhost_crypto.c: In function ‘rte_vhost_crypto_set_zero_copy’:
lib/librte_vhost/vhost_crypto.c:1192:2: error: comparison of unsigned expression < 0 is always false [-Werror=type-limits]

As enums can be either signed or unsigned, this patch removes
the negative check and cast to unsigned the upper limit check.

Fixes: 939066d96563 ("vhost/crypto: add public function implementation")

Signed-off-by: Maxime Coquelin <maxime.coquelin@redhat.com>
---
 lib/librte_vhost/vhost_crypto.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/lib/librte_vhost/vhost_crypto.c b/lib/librte_vhost/vhost_crypto.c
index c38eb3bb5..c6fb2fe5f 100644
--- a/lib/librte_vhost/vhost_crypto.c
+++ b/lib/librte_vhost/vhost_crypto.c
@@ -1189,8 +1189,8 @@ rte_vhost_crypto_set_zero_copy(int vid, enum rte_vhost_crypto_zero_copy option)
 		return -EINVAL;
 	}
 
-	if (unlikely(option < 0 || option >=
-			RTE_VHOST_CRYPTO_MAX_ZERO_COPY_OPTIONS)) {
+	if (unlikely((uint32_t)option >=
+				RTE_VHOST_CRYPTO_MAX_ZERO_COPY_OPTIONS)) {
 		VC_LOG_ERR("Invalid option %i", option);
 		return -EINVAL;
 	}
-- 
2.14.3

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2018-04-27  9:25 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-04-27  9:04 [dpdk-dev] [PATCH] vhost/crypto: fix build issue with GCC 4.7.2 Maxime Coquelin
2018-04-27  9:25 ` Thomas Monjalon

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).