libcli: Fix coverity warning in smb2cli_notify_send()
authorAndreas Schneider <asn@samba.org>
Wed, 16 May 2018 14:54:47 +0000 (16:54 +0200)
committerAndrew Bartlett <abartlet@samba.org>
Wed, 16 May 2018 19:30:23 +0000 (21:30 +0200)
result_independent_of_operands: "(uint16_t)(recursive ? 1 : 0) >> 8" is
0 regardless of the values of its operands. This occurs as the operand
of assignment.

Found by Coverity.

Pair-Programmed-With: Ralph Boehme <slow@samba.org>

Signed-off-by: Andreas Schneider <asn@samba.org>
Signed-off-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
libcli/smb/smb2cli_notify.c

index 34329ba16cccb23e937f2f80c7116a7c71ff8a0b..1a2a2793a32b06623c29b6894c66c0648b495564 100644 (file)
@@ -52,15 +52,18 @@ struct tevent_req *smb2cli_notify_send(TALLOC_CTX *mem_ctx,
        struct tevent_req *req, *subreq;
        struct smb2cli_notify_state *state;
        uint8_t *fixed;
+       uint16_t watch_tree;
 
        req = tevent_req_create(mem_ctx, &state,
                                struct smb2cli_notify_state);
        if (req == NULL) {
                return NULL;
        }
+
+       watch_tree = recursive ? SMB2_WATCH_TREE : 0;
        fixed = state->fixed;
        SSVAL(fixed, 0, 32);
-       SSVAL(fixed, 2, recursive ? SMB2_WATCH_TREE : 0);
+       SSVAL(fixed, 2, watch_tree);
        SIVAL(fixed, 4, output_buffer_length);
        SBVAL(fixed, 8, fid_persistent);
        SBVAL(fixed, 16, fid_volatile);