Skip to content

Conversation

@alex-moch
Copy link
Contributor

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

Closes #17682
Closes #17684
(cherry picked from commit 9acedba)


Motivation and Context

Builds with LLVM/Clang 21 fail due to the new -Wuninitialized-const-pointer warning. This prevents proper detection of the bdev_file_open_by_path() interface on kernel 6.9+.

This is the same backport for v2.2 as pull request #17997 is for v2.3.

Description

This cherry-pick fixes a build failure with LLVM/Clang 21 by initializing the blk_holder_ops pointer to NULL in the bdev_file_open_by_path() configure check. Since ZFS doesn't use blk_holder_ops, this change is safe and allows the configure check to pass.

How Has This Been Tested?

Clean cherry-pick from the master branch where it was already tested and reviewed.

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:

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
(cherry picked from commit 9acedba)
Signed-off-by: Alexander Moch <mail@alexmoch.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants