Skip to content

Conversation

@alex-moch
Copy link
Contributor

@alex-moch alex-moch commented Nov 30, 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 [email protected]

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+.

Fixes #17959 and #17994

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 <[email protected]>
Signed-off-by: Brian Behlendorf <[email protected]>
Closes openzfs#17682
Closes openzfs#17684
(cherry picked from commit 9acedba)
Signed-off-by: Alexander Moch <[email protected]>
@github-actions github-actions bot added the Status: Work in Progress Not yet ready for general review label Nov 30, 2025
@alex-moch alex-moch marked this pull request as ready for review November 30, 2025 23:40
@github-actions github-actions bot added Status: Code Review Needed Ready for review and testing and removed Status: Work in Progress Not yet ready for general review labels Nov 30, 2025
@alex-moch alex-moch changed the base branch from zfs-2.3-release to zfs-2.3.6-staging December 1, 2025 08:50
@amotin amotin added Status: Accepted Ready to integrate (reviewed, tested) and removed Status: Code Review Needed Ready for review and testing labels Dec 1, 2025
@tonyhutter tonyhutter merged commit 2d9ba1e into openzfs:zfs-2.3.6-staging Dec 3, 2025
26 of 29 checks passed
@alex-moch alex-moch deleted the backport-17684-to-2.3 branch December 4, 2025 16:06
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)

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants