commit:     e5ac9fc75373b789e8e87fb1493fe7b4f40fae2a
Author:     Michal Rostecki <vadorovsky <AT> protonmail <DOT> com>
AuthorDate: Fri Sep 12 12:36:54 2025 +0000
Commit:     Sam James <sam <AT> gentoo <DOT> org>
CommitDate: Sat Sep 13 09:02:09 2025 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=e5ac9fc7

sys-fs/zfs-kmod: Fix build with LLVM 21

Provide a patch which fixes the bdev interface detection by fixing the
-Wuninitialized-const-pointer warning from LLVM 21.

Closes: https://bugs.gentoo.org/962778
Signed-off-by: Michal Rostecki <vadorovsky <AT> protonmail.com>
Part-of: https://github.com/gentoo/gentoo/pull/43750
Closes: https://github.com/gentoo/gentoo/pull/43750
Signed-off-by: Sam James <sam <AT> gentoo.org>

 .../files/zfs-kmod-2.3.3-bdev-interface.patch      | 60 ++++++++++++++++++++++
 sys-fs/zfs-kmod/zfs-kmod-2.3.3.ebuild              |  1 +
 sys-fs/zfs-kmod/zfs-kmod-2.3.4.ebuild              |  1 +
 sys-fs/zfs-kmod/zfs-kmod-2.4.0_rc1.ebuild          |  1 +
 4 files changed, 63 insertions(+)

diff --git a/sys-fs/zfs-kmod/files/zfs-kmod-2.3.3-bdev-interface.patch 
b/sys-fs/zfs-kmod/files/zfs-kmod-2.3.3-bdev-interface.patch
new file mode 100644
index 000000000000..61ec9a7e02b0
--- /dev/null
+++ b/sys-fs/zfs-kmod/files/zfs-kmod-2.3.3-bdev-interface.patch
@@ -0,0 +1,60 @@
+From 9acedbaceec362d08a33ebfe7c4c7efcee81d094 Mon Sep 17 00:00:00 2001
+From: Brian Behlendorf <[email protected]>
+Date: Tue, 2 Sep 2025 09:34:08 -0700
+Subject: [PATCH] config: Fix LLVM-21 -Wuninitialized-const-pointer warning
+
+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 #17682
+Closes #17684
+---
+ config/kernel-blkdev.m4 | 9 +++------
+ 1 file changed, 3 insertions(+), 6 deletions(-)
+
+diff --git a/config/kernel-blkdev.m4 b/config/kernel-blkdev.m4
+index 83190c6fbe3f..02011bf39fb2 100644
+--- a/config/kernel-blkdev.m4
++++ b/config/kernel-blkdev.m4
+@@ -29,9 +29,8 @@ AC_DEFUN([ZFS_AC_KERNEL_SRC_BLKDEV_GET_BY_PATH_4ARG], [
+               const char *path = "path";
+               fmode_t mode = 0;
+               void *holder = NULL;
+-              struct blk_holder_ops h;
+ 
+-              bdev = blkdev_get_by_path(path, mode, holder, &h);
++              bdev = blkdev_get_by_path(path, mode, holder, NULL);
+       ])
+ ])
+ 
+@@ -48,9 +47,8 @@ AC_DEFUN([ZFS_AC_KERNEL_SRC_BLKDEV_BDEV_OPEN_BY_PATH], [
+               const char *path = "path";
+               fmode_t mode = 0;
+               void *holder = NULL;
+-              struct blk_holder_ops h;
+ 
+-              bdh = bdev_open_by_path(path, mode, holder, &h);
++              bdh = bdev_open_by_path(path, mode, holder, NULL);
+       ])
+ ])
+ 
+@@ -68,9 +66,8 @@ AC_DEFUN([ZFS_AC_KERNEL_SRC_BDEV_FILE_OPEN_BY_PATH], [
+               const char *path = "path";
+               fmode_t mode = 0;
+               void *holder = NULL;
+-              struct blk_holder_ops h;
+ 
+-              file = bdev_file_open_by_path(path, mode, holder, &h);
++              file = bdev_file_open_by_path(path, mode, holder, NULL);
+       ])
+ ])
+ 

diff --git a/sys-fs/zfs-kmod/zfs-kmod-2.3.3.ebuild 
b/sys-fs/zfs-kmod/zfs-kmod-2.3.3.ebuild
index cb2767dde26b..f3849b11b6c6 100644
--- a/sys-fs/zfs-kmod/zfs-kmod-2.3.3.ebuild
+++ b/sys-fs/zfs-kmod/zfs-kmod-2.3.3.ebuild
@@ -61,6 +61,7 @@ PDEPEND="dist-kernel? ( ~sys-fs/zfs-${PV}[dist-kernel] )"
 
 PATCHES=(
        "${FILESDIR}"/${PN}-2.1.11-gentoo.patch
+       "${FILESDIR}"/${PN}-2.3.3-bdev-interface.patch
 )
 
 pkg_pretend() {

diff --git a/sys-fs/zfs-kmod/zfs-kmod-2.3.4.ebuild 
b/sys-fs/zfs-kmod/zfs-kmod-2.3.4.ebuild
index 6f130dc29856..57a8be39bf91 100644
--- a/sys-fs/zfs-kmod/zfs-kmod-2.3.4.ebuild
+++ b/sys-fs/zfs-kmod/zfs-kmod-2.3.4.ebuild
@@ -61,6 +61,7 @@ PDEPEND="dist-kernel? ( ~sys-fs/zfs-${PV}[dist-kernel] )"
 
 PATCHES=(
        "${FILESDIR}"/${PN}-2.1.11-gentoo.patch
+       "${FILESDIR}"/${PN}-2.3.3-bdev-interface.patch
 )
 
 pkg_pretend() {

diff --git a/sys-fs/zfs-kmod/zfs-kmod-2.4.0_rc1.ebuild 
b/sys-fs/zfs-kmod/zfs-kmod-2.4.0_rc1.ebuild
index 6f130dc29856..57a8be39bf91 100644
--- a/sys-fs/zfs-kmod/zfs-kmod-2.4.0_rc1.ebuild
+++ b/sys-fs/zfs-kmod/zfs-kmod-2.4.0_rc1.ebuild
@@ -61,6 +61,7 @@ PDEPEND="dist-kernel? ( ~sys-fs/zfs-${PV}[dist-kernel] )"
 
 PATCHES=(
        "${FILESDIR}"/${PN}-2.1.11-gentoo.patch
+       "${FILESDIR}"/${PN}-2.3.3-bdev-interface.patch
 )
 
 pkg_pretend() {

Reply via email to