Skip to content

Commit

Permalink
Fix unitialized variable in zstream redup command
Browse files Browse the repository at this point in the history
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.

Reviewed-by: Matthew Ahrens <[email protected]>
Reviewed-by: George Melikov <[email protected]>
Signed-off-by: Brian Behlendorf <[email protected]>
Closes #10241
Closes #10244
  • Loading branch information
behlendorf authored Apr 23, 2020
1 parent 5d4ed96 commit 6de3e59
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion cmd/zstream/zstream_redup.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down

0 comments on commit 6de3e59

Please sign in to comment.