From d6ec70e71cca89687f25fc62f95416598c44b9ad Mon Sep 17 00:00:00 2001 From: Brian Behlendorf Date: Fri, 10 Apr 2020 16:17:13 -0700 Subject: [PATCH] Fix uninitialized variable in `zstream redup` command 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 --- cmd/zstream/zstream_redup.c | 1 + 1 file changed, 1 insertion(+) diff --git a/cmd/zstream/zstream_redup.c b/cmd/zstream/zstream_redup.c index 6720cfd1201c..9ed8df337f01 100644 --- a/cmd/zstream/zstream_redup.c +++ b/cmd/zstream/zstream_redup.c @@ -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");