datapath-windows: Fix static analysis warnings in OvsGetTcpPayloadLength
This fixes the static code analysis over the function
'OvsGetTcpPayloadLength'.
Acked-by: Shashank Ram
@@ -157,20 +157,17 @@ static __inline UINT32
OvsGetTcpPayloadLength(PNET_BUFFER_LIST nbl)
{
IPHdr *ipHdr;
- char *ipBuf[sizeof(IPHdr)];
- PNET_BUFFER curNb;
- curNb = NET_BUFFER_LIST_FIRST_NB(nbl);
- UINT32 hdrLen = sizeof(EthHdr);
- NdisAdvanceNetBufferDataStart(curNb, hdrLen, FALSE, NULL);
- ipHdr = NdisGetDataBuffer(curNb, sizeof *ipHdr, (PVOID) &ipBuf,
- 1 /*no align*/, 0);
+ TCPHdr *tcp;
+ char *ipBuf[sizeof(EthHdr) + sizeof(IPHdr) + sizeof(TCPHdr)];
+
+ ipHdr = NdisGetDataBuffer(NET_BUFFER_LIST_FIRST_NB(nbl), sizeof *ipBuf,
+ (PVOID)&ipBuf, 1 /*no align*/, 0);
if (ipHdr == NULL) {
- NdisRetreatNetBufferDataStart(curNb, hdrLen, 0, NULL);
return 0;
}
- TCPHdr *tcp = (TCPHdr *)((PCHAR)ipHdr + ipHdr->ihl * 4);
- NdisRetreatNetBufferDataStart(curNb, hdrLen, 0, NULL);
+ ipHdr = (IPHdr *)((PCHAR)ipHdr + sizeof(EthHdr));
+ tcp = (TCPHdr *)((PCHAR)ipHdr + ipHdr->ihl * 4);
return (ntohs(ipHdr->tot_len) - (ipHdr->ihl * 4) - (TCP_HDR_LEN(tcp)));
}
