________________________________________ From: ovs-dev-boun...@openvswitch.org <ovs-dev-boun...@openvswitch.org> on behalf of Alin Serdean <aserd...@cloudbasesolutions.com> Sent: Thursday, July 13, 2017 9:40 PM To: d...@openvswitch.org Subject: [ovs-dev] [PATCH 32/40] datapath-windows: fix excessive stack usage in iphelper
`OvsGetOrResolveIPNeigh` uses a stack over 1024 bytes. Switch one parameter to be a pointer. Found using WDK 8.1 static code analysis. Signed-off-by: Alin Gabriel Serdean <aserd...@cloudbasesolutions.com> --- datapath-windows/ovsext/IpHelper.c | 15 +++++++-------- 1 file changed, 7 insertions(+), 8 deletions(-) diff --git a/datapath-windows/ovsext/IpHelper.c b/datapath-windows/ovsext/IpHelper.c index cb97835..0af249e 100644 --- a/datapath-windows/ovsext/IpHelper.c +++ b/datapath-windows/ovsext/IpHelper.c @@ -485,7 +485,7 @@ OvsResolveIPNeighEntry(PMIB_IPNET_ROW2 ipNeigh) NTSTATUS -OvsGetOrResolveIPNeigh(MIB_IF_ROW2 ipRow, +OvsGetOrResolveIPNeigh(PMIB_IF_ROW2 ipRow, UINT32 ipAddr, PMIB_IPNET_ROW2 ipNeigh) { @@ -494,8 +494,8 @@ OvsGetOrResolveIPNeigh(MIB_IF_ROW2 ipRow, ASSERT(ipNeigh); RtlZeroMemory(ipNeigh, sizeof (*ipNeigh)); - ipNeigh->InterfaceLuid.Value = ipRow.InterfaceLuid.Value; - ipNeigh->InterfaceIndex = ipRow.InterfaceIndex; + ipNeigh->InterfaceLuid.Value = ipRow->InterfaceLuid.Value; + ipNeigh->InterfaceIndex = ipRow->InterfaceIndex; ipNeigh->Address.si_family = AF_INET; ipNeigh->Address.Ipv4.sin_addr.s_addr = ipAddr; @@ -503,8 +503,8 @@ OvsGetOrResolveIPNeigh(MIB_IF_ROW2 ipRow, if (status != STATUS_SUCCESS) { RtlZeroMemory(ipNeigh, sizeof (*ipNeigh)); - ipNeigh->InterfaceLuid.Value = ipRow.InterfaceLuid.Value; - ipNeigh->InterfaceIndex = ipRow.InterfaceIndex; + ipNeigh->InterfaceLuid.Value = ipRow->InterfaceLuid.Value; + ipNeigh->InterfaceIndex = ipRow->InterfaceIndex; ipNeigh->Address.si_family = AF_INET; ipNeigh->Address.Ipv4.sin_addr.s_addr = ipAddr; status = OvsResolveIPNeighEntry(ipNeigh); @@ -1644,7 +1644,7 @@ OvsHandleFwdRequest(POVS_IP_HELPER_REQUEST request) if (ipAddr == 0) { ipAddr = request->fwdReq.tunnelKey.dst; } - status = OvsGetOrResolveIPNeigh(instance->internalRow, + status = OvsGetOrResolveIPNeigh(&instance->internalRow, ipAddr, &ipNeigh); if (status != STATUS_SUCCESS) { ExReleaseResourceLite(&instance->lock); @@ -1936,11 +1936,10 @@ OvsStartIpHelper(PVOID data) MIB_IPNET_ROW2 ipNeigh; NTSTATUS status; POVS_IPHELPER_INSTANCE instance = (POVS_IPHELPER_INSTANCE)ipn->context; - MIB_IF_ROW2 internalRow = instance->internalRow; NdisReleaseSpinLock(&ovsIpHelperLock); ExAcquireResourceExclusiveLite(&ovsInstanceListLock, TRUE); - status = OvsGetOrResolveIPNeigh(internalRow, + status = OvsGetOrResolveIPNeigh(&instance->internalRow, ipAddr, &ipNeigh); OvsUpdateIPNeighEntry(ipAddr, &ipNeigh, status); -- 2.10.2.windows.1 _______________________________________________ Acked-by: Shashank Ram <r...@vmware.com> _______________________________________________ dev mailing list d...@openvswitch.org https://mail.openvswitch.org/mailman/listinfo/ovs-dev