From: Noel Power Date: Wed, 10 Jul 2019 15:34:56 +0000 (+0100) Subject: libcls/netlogon: clang: Fix 'initialization value is never read' X-Git-Tag: talloc-2.3.0~83 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=9cfdb9f190688682dd62d7c148f1d801921a3b92;p=thirdparty%2Fsamba.git libcls/netlogon: clang: Fix 'initialization value is never read' Fixes: libcli/netlogon/netlogon.c:183:11: warning: Value stored to 'status' during its initialization is never read <--[clang] NTSTATUS status = NT_STATUS_INVALID_NETWORK_RESPONSE; ^~~~~~ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ libcli/netlogon/netlogon.c:224:11: warning: Value stored to 'status' during its initialization is never read <--[clang] NTSTATUS status = NT_STATUS_INVALID_NETWORK_RESPONSE; ^~~~~~ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 2 warnings generated. Note: although use of default seems unecessary but gcc (with --picky-developer) detects the possibiliy still that status may be undefined (presumably by a non enum value leaking into the switch) Signed-off-by: Noel Power Reviewed-by: Gary Lockyer --- diff --git a/libcli/netlogon/netlogon.c b/libcli/netlogon/netlogon.c index 58a331d70ad..239503e85b6 100644 --- a/libcli/netlogon/netlogon.c +++ b/libcli/netlogon/netlogon.c @@ -180,7 +180,7 @@ void map_netlogon_samlogon_response(struct netlogon_samlogon_response *response) NTSTATUS push_nbt_netlogon_response(DATA_BLOB *data, TALLOC_CTX *mem_ctx, struct nbt_netlogon_response *response) { - NTSTATUS status = NT_STATUS_INVALID_NETWORK_RESPONSE; + NTSTATUS status; enum ndr_err_code ndr_err; switch (response->response_type) { case NETLOGON_GET_PDC: @@ -212,6 +212,9 @@ NTSTATUS push_nbt_netlogon_response(DATA_BLOB *data, TALLOC_CTX *mem_ctx, } status = NT_STATUS_OK; break; + default: + status = NT_STATUS_INVALID_NETWORK_RESPONSE; + break; } return status; @@ -221,7 +224,7 @@ NTSTATUS push_nbt_netlogon_response(DATA_BLOB *data, TALLOC_CTX *mem_ctx, NTSTATUS pull_nbt_netlogon_response(DATA_BLOB *data, TALLOC_CTX *mem_ctx, struct nbt_netlogon_response *response) { - NTSTATUS status = NT_STATUS_INVALID_NETWORK_RESPONSE; + NTSTATUS status; enum netlogon_command command; enum ndr_err_code ndr_err; if (data->length < 4) { @@ -273,6 +276,7 @@ NTSTATUS pull_nbt_netlogon_response(DATA_BLOB *data, TALLOC_CTX *mem_ctx, case LOGON_REQUEST: case NETLOGON_ANNOUNCE_UAS: case LOGON_SAM_LOGON_REQUEST: + default: status = NT_STATUS_INVALID_NETWORK_RESPONSE; }