diff mbox series

net/handshake: fix section mismatch error for handshake_genl_net_ops

Message ID 20230421082450.2572594-1-arnd@kernel.org (mailing list archive)
State Not Applicable
Delegated to: Netdev Maintainers
Headers show
Series net/handshake: fix section mismatch error for handshake_genl_net_ops | expand

Checks

Context Check Description
netdev/series_format warning Single patches do not need cover letters; Target tree name not specified in the subject
netdev/tree_selection success Guessed tree name to be net-next
netdev/fixes_present success Fixes tag not required for -next series
netdev/header_inline success No static functions without inline keyword in header files
netdev/build_32bit success Errors and warnings before: 10 this patch: 10
netdev/cc_maintainers success CCed 7 of 7 maintainers
netdev/build_clang success Errors and warnings before: 8 this patch: 8
netdev/verify_signedoff success Signed-off-by tag matches author and committer
netdev/deprecated_api success None detected
netdev/check_selftest success No net selftest shell script
netdev/verify_fixes success Fixes tag looks correct
netdev/build_allmodconfig_warn success Errors and warnings before: 10 this patch: 10
netdev/checkpatch success total: 0 errors, 0 warnings, 0 checks, 8 lines checked
netdev/kdoc success Errors and warnings before: 0 this patch: 0
netdev/source_inline success Was 0 now: 0

Commit Message

Arnd Bergmann April 21, 2023, 8:24 a.m. UTC
From: Arnd Bergmann <arnd@arndb.de>

The new netlink interface causes a link-time warning about the use of
a discarded symbol:

WARNING: modpost: vmlinux.o: section mismatch in reference: handshake_exit (section: .exit.text) -> (unknown) (section: .init.data)
ERROR: modpost: Section mismatches detected.

There are other instances of pernet_operations that are marked as
__net_initdata as well, so I'm not sure what the lifetime rules are,
but it's clear that any discarded symbol cannot be referenced from an
exitcall, so remove that annotation here.

Fixes: 3b3009ea8abb ("net/handshake: Create a NETLINK service for handling handshake requests")
Signed-off-by: Arnd Bergmann <arnd@arndb.de>
---
 net/handshake/netlink.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

Chuck Lever III April 21, 2023, 1:25 p.m. UTC | #1
> On Apr 21, 2023, at 4:24 AM, Arnd Bergmann <arnd@kernel.org> wrote:
> 
> From: Arnd Bergmann <arnd@arndb.de>
> 
> The new netlink interface causes a link-time warning about the use of
> a discarded symbol:
> 
> WARNING: modpost: vmlinux.o: section mismatch in reference: handshake_exit (section: .exit.text) -> (unknown) (section: .init.data)
> ERROR: modpost: Section mismatches detected.
> 
> There are other instances of pernet_operations that are marked as
> __net_initdata as well, so I'm not sure what the lifetime rules are,
> but it's clear that any discarded symbol cannot be referenced from an
> exitcall, so remove that annotation here.
> 
> Fixes: 3b3009ea8abb ("net/handshake: Create a NETLINK service for handling handshake requests")
> Signed-off-by: Arnd Bergmann <arnd@arndb.de>

Thank you, Arnd. We received two other patches yesterday
with the same build error report and suggested fix.


> ---
> net/handshake/netlink.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/net/handshake/netlink.c b/net/handshake/netlink.c
> index 8ea0ff993f9f..35c9c445e0b8 100644
> --- a/net/handshake/netlink.c
> +++ b/net/handshake/netlink.c
> @@ -249,7 +249,7 @@ static void __net_exit handshake_net_exit(struct net *net)
> }
> }
> 
> -static struct pernet_operations __net_initdata handshake_genl_net_ops = {
> +static struct pernet_operations handshake_genl_net_ops = {
> .init = handshake_net_init,
> .exit = handshake_net_exit,
> .id = &handshake_net_id,
> -- 
> 2.39.2
> 

--
Chuck Lever
diff mbox series

Patch

diff --git a/net/handshake/netlink.c b/net/handshake/netlink.c
index 8ea0ff993f9f..35c9c445e0b8 100644
--- a/net/handshake/netlink.c
+++ b/net/handshake/netlink.c
@@ -249,7 +249,7 @@  static void __net_exit handshake_net_exit(struct net *net)
 	}
 }
 
-static struct pernet_operations __net_initdata handshake_genl_net_ops = {
+static struct pernet_operations handshake_genl_net_ops = {
 	.init		= handshake_net_init,
 	.exit		= handshake_net_exit,
 	.id		= &handshake_net_id,