[ovs-dev] [PATCH 35/40] datapath-windows: Treat TCP_HDR_LEN static analysis warnings

Alin Serdean aserdean at cloudbasesolutions.com
Fri Jul 14 04:40:57 UTC 2017


Using the shift operator in macros makes the static analyzer on WDK 8.1 confused.

Switch to multiplication when trying to get the data offset of the TCP header.

Signed-off-by: Alin Gabriel Serdean <aserdean at cloudbasesolutions.com>
---
 datapath-windows/ovsext/NetProto.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/datapath-windows/ovsext/NetProto.h b/datapath-windows/ovsext/NetProto.h
index 92d6611..9a17dee 100644
--- a/datapath-windows/ovsext/NetProto.h
+++ b/datapath-windows/ovsext/NetProto.h
@@ -68,7 +68,7 @@ typedef UINT64 IP4FragUnitLength;
 // length UINT for ipv6 header length.
 typedef UINT64 IP6UnitLength;
 
-#define TCP_HDR_LEN(tcph)             IP4_UNITS_TO_BYTES((tcph)->doff)
+#define TCP_HDR_LEN(tcph)             ((tcph)->doff * 4)
 #define TCP_DATA_LENGTH(iph, tcph)    (ntohs(iph->tot_len) -                \
                                        IP4_HDR_LEN(iph) - TCP_HDR_LEN(tcph))
 
-- 
2.10.2.windows.1


More information about the dev mailing list