From 262ec18d0fbb6a88b130eac73a5efc451763f067 Mon Sep 17 00:00:00 2001 From: Brian Behlendorf Date: Thu, 23 Apr 2020 09:20:48 -0700 Subject: [PATCH] Fix unitialized variable in `zstream redup` command Fix uninitialized variable in `zstream redup` command. The compiler may determine the 'stream_offset' variable can be uninitialized because not all rdt_lookup() exit paths set it. This should never happen in practice as documented by the assert, but initialize it regardless to resolve the warning. Signed-off-by: Brian Behlendorf Issue #10241 --- cmd/zstream/zstream_redup.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cmd/zstream/zstream_redup.c b/cmd/zstream/zstream_redup.c index 9ed8df337f01..379025ce59e5 100644 --- a/cmd/zstream/zstream_redup.c +++ b/cmd/zstream/zstream_redup.c @@ -308,7 +308,7 @@ zfs_redup_stream(int infd, int outfd, boolean_t verbose) * record with the found WRITE record, but with * drr_object,drr_offset,drr_toguid replaced with ours. */ - uint64_t stream_offset; + uint64_t stream_offset = 0; rdt_lookup(&rdt, drrwb.drr_refguid, drrwb.drr_refobject, drrwb.drr_refoffset, &stream_offset);