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: Brian Behlendorf <behlendorf1@llnl.gov>
Issue openzfs#10241
  • Loading branch information
behlendorf committed Apr 23, 2020
1 parent 70e5ad3 commit edbf2d1
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 edbf2d1

Please sign in to comment.