Skip to content

Commit

Permalink
Fix uninitialized variable in zstream redup command
Browse files Browse the repository at this point in the history
The 'rdt.ddt_count' variable is uninitialized because it was
allocated from the stack and not globally.  Initialize it.
This was reported by gcc when compiling with debugging enabled.

    zstream_redup.c:157:16: error: 'rdt.ddt_count' may be used
    uninitialized in this function [-Werror=maybe-uninitialized]

Signed-off-by: Brian Behlendorf <[email protected]>
  • Loading branch information
behlendorf committed Apr 10, 2020
1 parent c618f87 commit d6ec70e
Showing 1 changed file with 1 addition and 0 deletions.
1 change: 1 addition & 0 deletions cmd/zstream/zstream_redup.c
Original file line number Diff line number Diff line change
Expand Up @@ -218,6 +218,7 @@ zfs_redup_stream(int infd, int outfd, boolean_t verbose)
rdt.ddecache = umem_cache_create("rde", sizeof (redup_entry_t), 0,
NULL, NULL, NULL, NULL, NULL, 0);
rdt.numhashbits = highbit64(numbuckets) - 1;
rdt.ddt_count = 0;

char *buf = safe_calloc(bufsz);
FILE *ofp = fdopen(infd, "r");
Expand Down

0 comments on commit d6ec70e

Please sign in to comment.