From mboxrd@z Thu Jan 1 00:00:00 1970 From: Maxime Coquelin Subject: [PATCH] vhost/crypto: fix build issue with GCC 4.7.2 Date: Fri, 27 Apr 2018 11:04:38 +0200 Message-ID: <20180427090438.31506-1-maxime.coquelin@redhat.com> Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Maxime Coquelin To: dev@dpdk.org, jianfeng.tan@intel.com, thomas@monjalon.net, roy.fan.zhang@intel.com Return-path: Received: from mx1.redhat.com (mx3-rdu2.redhat.com [66.187.233.73]) by dpdk.org (Postfix) with ESMTP id 7B6067CCA for ; Fri, 27 Apr 2018 11:04:52 +0200 (CEST) List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org Sender: "dev" 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 --- 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