________________________________________
From: [email protected] <[email protected]> on 
behalf of Alin Serdean <[email protected]>
Sent: Thursday, July 13, 2017 9:40 PM
To: [email protected]
Subject: [ovs-dev] [PATCH 10/40] datapath-windows: Fix possible NULL    
deference

`ethHdr` may be NULL while trying to push mpls lables.

Found with WDK 10 static code analysis.

Signed-off-by: Alin Gabriel Serdean <[email protected]>
---
 datapath-windows/ovsext/Actions.c | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/datapath-windows/ovsext/Actions.c 
b/datapath-windows/ovsext/Actions.c
index ebe8264..39539e0 100644
--- a/datapath-windows/ovsext/Actions.c
+++ b/datapath-windows/ovsext/Actions.c
@@ -1244,6 +1244,10 @@ OvsActionMplsPush(OvsForwardingContext *ovsFwdCtx,
     ASSERT(mdlLen >= MPLS_HLEN);

     ethHdr = (EthHdr *)(bufferStart + curMdlOffset);
+    if (!ethHdr) {
+        ovsActionStats.noResource++;
+        return NDIS_STATUS_RESOURCES;

NDIS_STATUS_RESOURCES is returned typically to return an error indicating 
insufficient resources. Under what cases will the ethHdr be NULL? Maybe for an 
invalid packet? 

+    }
     RtlMoveMemory(ethHdr, (UINT8*)ethHdr + MPLS_HLEN, sizeof(*ethHdr));
     ethHdr->Type = mpls->mpls_ethertype;

--

_______________________________________________
dev mailing list
[email protected]
https://mail.openvswitch.org/mailman/listinfo/ovs-dev

Reply via email to