Skip to content

Commit 9bd527e

Browse files
committed
config: Fix LLVM-21 -Wuninitialized-const-pointer warning
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. Initialize the structure in the configure test to resolve the warning and detect the interface. 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>
1 parent 5a8ba45 commit 9bd527e

File tree

1 file changed

+30
-6
lines changed

1 file changed

+30
-6
lines changed

config/kernel-blkdev.m4

Lines changed: 30 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -24,14 +24,22 @@ AC_DEFUN([ZFS_AC_KERNEL_SRC_BLKDEV_GET_BY_PATH_4ARG], [
2424
ZFS_LINUX_TEST_SRC([blkdev_get_by_path_4arg], [
2525
#include <linux/fs.h>
2626
#include <linux/blkdev.h>
27+
28+
static void
29+
test_mark_dead(struct block_device *bdev) {
30+
return;
31+
}
32+
33+
const struct blk_holder_ops test_holder_ops = {
34+
.mark_dead = test_mark_dead,
35+
};
2736
], [
2837
struct block_device *bdev __attribute__ ((unused)) = NULL;
2938
const char *path = "path";
3039
fmode_t mode = 0;
3140
void *holder = NULL;
32-
struct blk_holder_ops h;
3341
34-
bdev = blkdev_get_by_path(path, mode, holder, &h);
42+
bdev = blkdev_get_by_path(path, mode, holder, &test_holder_ops);
3543
])
3644
])
3745

@@ -43,14 +51,22 @@ AC_DEFUN([ZFS_AC_KERNEL_SRC_BLKDEV_BDEV_OPEN_BY_PATH], [
4351
ZFS_LINUX_TEST_SRC([bdev_open_by_path], [
4452
#include <linux/fs.h>
4553
#include <linux/blkdev.h>
54+
55+
static void
56+
test_mark_dead(struct block_device *bdev, bool flag) {
57+
return;
58+
}
59+
60+
const struct blk_holder_ops test_holder_ops = {
61+
.mark_dead = test_mark_dead,
62+
};
4663
], [
4764
struct bdev_handle *bdh __attribute__ ((unused)) = NULL;
4865
const char *path = "path";
4966
fmode_t mode = 0;
5067
void *holder = NULL;
51-
struct blk_holder_ops h;
5268
53-
bdh = bdev_open_by_path(path, mode, holder, &h);
69+
bdh = bdev_open_by_path(path, mode, holder, &test_holder_ops);
5470
])
5571
])
5672

@@ -63,14 +79,22 @@ AC_DEFUN([ZFS_AC_KERNEL_SRC_BDEV_FILE_OPEN_BY_PATH], [
6379
ZFS_LINUX_TEST_SRC([bdev_file_open_by_path], [
6480
#include <linux/fs.h>
6581
#include <linux/blkdev.h>
82+
83+
static void
84+
test_mark_dead(struct block_device *bdev, bool flag) {
85+
return;
86+
}
87+
88+
const struct blk_holder_ops test_holder_ops = {
89+
.mark_dead = test_mark_dead,
90+
};
6691
], [
6792
struct file *file __attribute__ ((unused)) = NULL;
6893
const char *path = "path";
6994
fmode_t mode = 0;
7095
void *holder = NULL;
71-
struct blk_holder_ops h;
7296
73-
file = bdev_file_open_by_path(path, mode, holder, &h);
97+
file = bdev_file_open_by_path(path, mode, holder, &test_holder_ops);
7498
])
7599
])
76100

0 commit comments

Comments
 (0)