[Swan-dev] [PATCH libreswan] netlink: Silence negative shift coverity false warning

avivh at mellanox.com avivh at mellanox.com
Thu Aug 31 15:24:07 UTC 2017


From: Aviv Heller <avivh at mellanox.com>

Use an unsigned type instead.

Signed-off-by: Aviv Heller <avivh at mellanox.com>
---
 programs/pluto/kernel_netlink.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/programs/pluto/kernel_netlink.c b/programs/pluto/kernel_netlink.c
index b12d19b..c8f7bfd 100644
--- a/programs/pluto/kernel_netlink.c
+++ b/programs/pluto/kernel_netlink.c
@@ -96,14 +96,14 @@
 /* Minimum priority number in SPD used by pluto. */
 #define MIN_SPD_PRIORITY 1024
 
-#define NIC_OFFLOAD_UNKNOWN (-2)
-#define NIC_OFFLOAD_UNSUPPORTED (-1)
+#define NIC_OFFLOAD_UNKNOWN     (UINT_MAX)
+#define NIC_OFFLOAD_UNSUPPORTED (UINT_MAX - 1)
 
 static int netlinkfd = NULL_FD;
 static int netlink_bcast_fd = NULL_FD;
 
 #ifdef USE_NIC_OFFLOAD
-static int netlink_esp_hw_offload = NIC_OFFLOAD_UNKNOWN;
+static unsigned int netlink_esp_hw_offload = NIC_OFFLOAD_UNKNOWN;
 #endif
 
 #define NE(x) { x, #x }	/* Name Entry -- shorthand for sparse_names */
-- 
1.8.3.1



More information about the Swan-dev mailing list