[SRU][N][PATCH 0/1] Fix -Wuninitialized in ctnetlink_secctx_size()

Magali Lemes magali.lemes at canonical.com
Fri Aug 15 22:18:40 UTC 2025


BugLink: https://bugs.launchpad.net/bugs/2120561

[Impact]
In ctnetlink_secctx_size() from net/netfilter/nf_conntrack_netlink.c,
`len` is used uninitialized, triggering the following warning when
compiling with Clang:

net/netfilter/nf_conntrack_netlink.c:674:41: warning: variable 'len' is uninitialized when used here [-Wuninitialized]
    674 |                + nla_total_size(sizeof(char) * len); /* CTA_SECCTX_NAME */
        |                                                ^~~
net/netfilter/nf_conntrack_netlink.c:667:9: note: initialize the variable 'len' to silence this warning
    667 |         int len, ret;
        |                ^
        |                 = 0

[Fix]
Match mainline commit 2d470c778120 ("lsm: replace context+len with lsm_context").

[Test Plan]
Compile with Clang, check the warning is gone and no other warning has been
triggered.

[Where problems could occur]
This patch touches bits of the netlink interface for nf_conntrack. However,
it addresses a clear mistake in the current implementation, so no issues
should be introduced.

Magali Lemes (1):
  UBUNTU: SAUCE: netfilter: ctnetlink: Fix -Wuninitialized in
    ctnetlink_secctx_size()

 net/netfilter/nf_conntrack_netlink.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

-- 
2.48.1




More information about the kernel-team mailing list