Skip to contentSkip to conversation

virtiofs: don't mark virtio_fs_sysfs_exit as __exit

PATCH In review Arnd Bergmann 2 participants 2 messages Feb 28, 2024

Subsystems (4)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 virtiofs: don't mark virtio_fs_sysfs_exit as __exit

From: Arnd Bergmann <[email protected]>

Calling an __exit function from an __init function is not allowed and will result in undefined behavior when the code is built-in:

WARNING: modpost: vmlinux: section mismatch in reference: virtio_fs_init+0x50 (section: .init.text) -> virtio_fs_sysfs_exit (section: .exit.text)

Remove the incorrect annotation.

Fixes a8f62f50b4e4 ("virtiofs: export filesystem tags through sysfs")
---
 fs/fuse/virtio_fs.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
fs/fuse/virtio_fs.c +1 -1
index 3a7dd48b534f..36d87dd3cb48 100644
@@ -1595,7 +1595,7 @@ static int __init virtio_fs_sysfs_init(void)
 	return 0;
 }
 
-static void __exit virtio_fs_sysfs_exit(void)
+static void virtio_fs_sysfs_exit(void)
 {
 	kset_unregister(virtio_fs_kset);
 	virtio_fs_kset = NULL;
Signature · 1 line
2.39.2
#1 lore raw
Quoted 8 lines · Arnd Bergmann

From: Arnd Bergmann <[email protected]>

Calling an __exit function from an __init function is not allowed and will result in undefined behavior when the code is built-in:

WARNING: modpost: vmlinux: section mismatch in reference: virtio_fs_init+0x50 (section: .init.text) -> virtio_fs_sysfs_exit (section: .exit.text)

Quoted 7 lines

Remove the incorrect annotation.

Fixes a8f62f50b4e4 ("virtiofs: export filesystem tags through sysfs")
---
 fs/fuse/virtio_fs.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Thanks, Arnd. Please see the duplicate patch that Miklos applied:
https://lore.kernel.org/linux-fsdevel/CAJfpegsjcZ-dnZYft3B5GBGCntmDR6R1n8PM5YCLmW9FJy1DEw@mail.gmail.com/T/#t

Stefan

Quoted 18 lines
fs/fuse/virtio_fs.c +1 -2
index 3a7dd48b534f..36d87dd3cb48 100644
@@ -1595,7 +1595,7 @@ static int __init virtio_fs_sysfs_init(void)
        return 0;
 }
 
-static void __exit virtio_fs_sysfs_exit(void)
+static void virtio_fs_sysfs_exit(void)
 {
        kset_unregister(virtio_fs_kset);
        virtio_fs_kset = NULL;
--

2.39.2