Skip to content

Commit

Permalink
datapath-windows: Vport check RtlStringCbLengthW return value
Browse files Browse the repository at this point in the history
The result of `RtlStringCbLengthW` is not currently checked and triggers
a warning using the WDK 8.1 static analysis.

This patch treats the result of `RtlStringCbLengthW`.

Signed-off-by: Alin Gabriel Serdean <aserdean@cloudbasesolutions.com>
Acked-by: Shashank Ram <shashank08@gmail.com>
  • Loading branch information
Alin Serdean authored and aserdean committed Nov 29, 2017
1 parent d3beb55 commit 960b789
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions datapath-windows/ovsext/Vport.c
Expand Up @@ -1144,8 +1144,13 @@ GetNICAlias(PNDIS_SWITCH_NIC_PARAMETERS nicParam,
if (status == STATUS_SUCCESS) {
RtlStringCbPrintfW(portFriendlyName->String,
IF_MAX_STRING_SIZE, L"%s", interfaceName);
RtlStringCbLengthW(portFriendlyName->String, IF_MAX_STRING_SIZE,
&len);
status = RtlStringCbLengthW(portFriendlyName->String,
IF_MAX_STRING_SIZE, &len);
if (!NT_SUCCESS(status)) {
OVS_LOG_ERROR("Failed to get the length of the string,"
"status: %x", status);
return status;
}
portFriendlyName->Length = (USHORT)len;
} else {
OVS_LOG_ERROR("Fail to convert interface LUID to alias, status: %x",
Expand Down

0 comments on commit 960b789

Please sign in to comment.