From mboxrd@z Thu Jan 1 00:00:00 1970 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) Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.rdu2.redhat.com [10.11.54.3]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id EFD874072CF9; Fri, 27 Apr 2018 09:04:51 +0000 (UTC) Received: from localhost.localdomain (ovpn-112-44.ams2.redhat.com [10.36.112.44]) by smtp.corp.redhat.com (Postfix) with ESMTP id 9D35110B2B22; Fri, 27 Apr 2018 09:04:48 +0000 (UTC) From: Maxime Coquelin To: dev@dpdk.org, jianfeng.tan@intel.com, thomas@monjalon.net, roy.fan.zhang@intel.com Cc: Maxime Coquelin 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 X-Scanned-By: MIMEDefang 2.78 on 10.11.54.3 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.11.55.7]); Fri, 27 Apr 2018 09:04:52 +0000 (UTC) X-Greylist: inspected by milter-greylist-4.5.16 (mx1.redhat.com [10.11.55.7]); Fri, 27 Apr 2018 09:04:52 +0000 (UTC) for IP:'10.11.54.3' DOMAIN:'int-mx03.intmail.prod.int.rdu2.redhat.com' HELO:'smtp.corp.redhat.com' FROM:'maxime.coquelin@redhat.com' RCPT:'' Subject: [dpdk-dev] [PATCH] vhost/crypto: fix build issue with GCC 4.7.2 X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 27 Apr 2018 09:04:52 -0000 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