Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

zstream_redup ‘stream_offset’ may be used uninitialized in this function #10241

Closed
IslandLife opened this issue Apr 23, 2020 · 0 comments
Closed
Labels
Type: Building Indicates an issue related to building binaries

Comments

@IslandLife
Copy link

IslandLife commented Apr 23, 2020

System information

Type Version/Name
Distribution Name Ubuntu
Distribution Version focal
Linux Kernel 5.4.0-26-generic
Architecture amd64
ZFS Version 0.8.0-734_g70e5ad31f
SPL Version

Describe the problem you're observing

ZFS compiles with very few warnings. However this one appears recently.

Describe how to reproduce the problem

compile

Include any warning/errors/backtraces from the system logs

Example:

Making all in zstream
  CC       zstream.o
  CC       zstream_dump.o
  CC       zstream_redup.o
zstream_redup.c: In function ‘zfs_redup_stream.constprop’:
zstream_redup.c:316:4: warning: ‘stream_offset’ may be used uninitialized in this function [-Wmaybe-uninitialized]
  316 |    spread(infd, drr, sizeof (*drr), stream_offset);
      |    ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  CCLD     zstream
Making all in zstreamdump
Making all in ztest

-->

@behlendorf behlendorf added the Type: Building Indicates an issue related to building binaries label Apr 23, 2020
behlendorf added a commit to behlendorf/zfs that referenced this issue Apr 23, 2020
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
behlendorf added a commit to behlendorf/zfs that referenced this issue Apr 23, 2020
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 <behlendorf1@llnl.gov>
Issue openzfs#10241
as-com pushed a commit to as-com/zfs that referenced this issue Jun 20, 2020
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 openzfs#10241
Closes openzfs#10244 
(cherry picked from commit 6de3e59)
jsai20 pushed a commit to jsai20/zfs that referenced this issue Mar 30, 2021
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 openzfs#10241
Closes openzfs#10244
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Type: Building Indicates an issue related to building binaries
Projects
None yet
Development

No branches or pull requests

2 participants