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.

Reviewed-by: Matthew Ahrens <mahrens@delphix.com>
Reviewed-by: George Melikov <mail@gmelikov.ru>
Signed-off-by: Brian Behlendorf <behlendorf1@llnl.gov>
Closes #10241
Closes #10244
This commit is contained in:
Brian Behlendorf 2020-04-23 15:54:38 -07:00 committed by GitHub
parent 5d4ed9614f
commit 6de3e59bdd
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 1 additions and 1 deletions

View File

@ -308,7 +308,7 @@ zfs_redup_stream(int infd, int outfd, boolean_t verbose)
* record with the found WRITE record, but with * record with the found WRITE record, but with
* drr_object,drr_offset,drr_toguid replaced with ours. * drr_object,drr_offset,drr_toguid replaced with ours.
*/ */
uint64_t stream_offset; uint64_t stream_offset = 0;
rdt_lookup(&rdt, drrwb.drr_refguid, rdt_lookup(&rdt, drrwb.drr_refguid,
drrwb.drr_refobject, drrwb.drr_refoffset, drrwb.drr_refobject, drrwb.drr_refoffset,
&stream_offset); &stream_offset);