Skip to content

Conversation

@behlendorf
Copy link
Contributor

@behlendorf behlendorf commented Aug 29, 2025

Motivation and Context

#17682

Description

By default LLVM-21 enables -Wuninitialized-const-pointer which results in the following compiler warning and the bdev_file_open_by_path() interface not being detected for 6.9 and newer kernels. The blk_holder_ops are not used by the ZFS code so we can safely use a NULL argument for this check.

bdev_file_open_by_path/bdev_file_open_by_path.c:110:54: error: variable 'h' is uninitialized when passed as a const pointer argument here [-Werror,-Wuninitialized-const-pointer]

Note: Initially I was inclined to initialize the blk_holder_ops struct which is the approach we use elsewhere, but after discovering how many times that structure has changed I opted for the simpler more robust change to pass NULL.

How Has This Been Tested?

Locally compiled, but not on all of the relevant kernels. The CI can help out some there, but we'll also want to do some manual testing with the relevant llvm versions.

Types of changes

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Performance enhancement (non-breaking change which improves efficiency)
  • Code cleanup (non-breaking change which makes code smaller or more readable)
  • Quality assurance (non-breaking change which makes the code more robust against bugs)
  • Breaking change (fix or feature that would cause existing functionality to change)
  • Library ABI change (libzfs, libzfs_core, libnvpair, libuutil and libzfsbootenv)
  • Documentation (a change to man pages or other documentation)

Checklist:

@behlendorf behlendorf added the Type: Building Indicates an issue related to building binaries label Aug 29, 2025
@behlendorf behlendorf force-pushed the issue-17682 branch 2 times, most recently from 9bd527e to 758eb97 Compare August 29, 2025 20:54
LLVM-21 enables -Wuninitialized-const-pointer which results in the
following compiler warning and the bdev_file_open_by_path() interface
not being detected for 6.9 and newer kernels.  The blk_holder_ops
are not used by the ZFS code so we can safely use a NULL argument
for this check.

    bdev_file_open_by_path/bdev_file_open_by_path.c:110:54: error:
    variable 'h' is uninitialized when passed as a const pointer
    argument here [-Werror,-Wuninitialized-const-pointer]

Signed-off-by: Brian Behlendorf <behlendorf1@llnl.gov>
@behlendorf behlendorf requested a review from robn August 29, 2025 22:16
@behlendorf behlendorf added the Status: Code Review Needed Ready for review and testing label Aug 29, 2025
Copy link
Member

@robn robn left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah, this looks good to me. We are of course going to let a signature change through, but the actual build should catch that, and if not, CI. And if that gets through, maybe we have other life choices to consider.

@behlendorf behlendorf added Status: Accepted Ready to integrate (reviewed, tested) and removed Status: Code Review Needed Ready for review and testing labels Sep 2, 2025
@behlendorf behlendorf merged commit 9acedba into openzfs:master Sep 2, 2025
36 of 43 checks passed
behlendorf added a commit to behlendorf/zfs that referenced this pull request Sep 10, 2025
LLVM-21 enables -Wuninitialized-const-pointer which results in the
following compiler warning and the bdev_file_open_by_path() interface
not being detected for 6.9 and newer kernels.  The blk_holder_ops
are not used by the ZFS code so we can safely use a NULL argument
for this check.

    bdev_file_open_by_path/bdev_file_open_by_path.c:110:54: error:
    variable 'h' is uninitialized when passed as a const pointer
    argument here [-Werror,-Wuninitialized-const-pointer]

Reviewed-by: Rob Norris <robn@despairlabs.com>
Signed-off-by: Brian Behlendorf <behlendorf1@llnl.gov>
Closes openzfs#17682
Closes openzfs#17684
ptr1337 pushed a commit to CachyOS/zfs that referenced this pull request Oct 21, 2025
LLVM-21 enables -Wuninitialized-const-pointer which results in the
following compiler warning and the bdev_file_open_by_path() interface
not being detected for 6.9 and newer kernels.  The blk_holder_ops
are not used by the ZFS code so we can safely use a NULL argument
for this check.

    bdev_file_open_by_path/bdev_file_open_by_path.c:110:54: error:
    variable 'h' is uninitialized when passed as a const pointer
    argument here [-Werror,-Wuninitialized-const-pointer]

Reviewed-by: Rob Norris <robn@despairlabs.com>
Signed-off-by: Brian Behlendorf <behlendorf1@llnl.gov>
Closes openzfs#17682
Closes openzfs#17684
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Status: Accepted Ready to integrate (reviewed, tested) Type: Building Indicates an issue related to building binaries

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants