… > url: https://github.com/intel-lab-lkp/linux/commits/Markus-Elfring/netlink-Improve-exception-handling-in-__netlink_kernel_create/20240101-015025 … > patch link: https://lore.kernel.org/r/223a61e9-f826-4f37-b514-ca6ed53b1269%40web.de … > All warnings (new ones prefixed by >>): > >>> net/netlink/af_netlink.c:2044:6: warning: variable 'sk' is used uninitialized whenever 'if' condition is true [-Wsometimes-uninitialized] … > … > ^1da177e4c3f41 Linus Torvalds 2005-04-16 2016 struct sock * > 9f00d9776bc5be Pablo Neira Ayuso 2012-09-08 2017 __netlink_kernel_create(struct net *net, int unit, struct module *module, > a31f2d17b331db Pablo Neira Ayuso 2012-06-29 2018 struct netlink_kernel_cfg *cfg) > ^1da177e4c3f41 Linus Torvalds 2005-04-16 2019 { > ^1da177e4c3f41 Linus Torvalds 2005-04-16 2020 struct socket *sock; > ^1da177e4c3f41 Linus Torvalds 2005-04-16 2021 struct sock *sk; … > 5c398dc8f5a58b Eric Dumazet 2010-10-24 2023 struct listeners *listeners = NULL; … > ^1da177e4c3f41 Linus Torvalds 2005-04-16 2032 if (sock_create_lite(PF_NETLINK, SOCK_DGRAM, unit, &sock)) > ^1da177e4c3f41 Linus Torvalds 2005-04-16 2033 return NULL; … > 5c398dc8f5a58b Eric Dumazet 2010-10-24 2043 listeners = kzalloc(sizeof(*listeners) + NLGRPSZ(groups), GFP_KERNEL); > 4277a083ecd2c8 Patrick McHardy 2006-03-20 @2044 if (!listeners) > 90ae404765d263 Markus Elfring 2023-12-31 2045 goto out_netlink_release_sock; > 4277a083ecd2c8 Patrick McHardy 2006-03-20 2046 > e547df909ec09d Markus Elfring 2023-12-31 2047 sk = sock->sk; > ^1da177e4c3f41 Linus Torvalds 2005-04-16 2048 sk->sk_data_ready = netlink_data_ready; … > 4fdb3bb723db46 Harald Welte 2005-08-09 2075 netlink_table_ungrab(); > 77247bbb309424 Patrick McHardy 2005-08-14 2076 return sk; > 77247bbb309424 Patrick McHardy 2005-08-14 2077 > 4fdb3bb723db46 Harald Welte 2005-08-09 2078 out_sock_release: > 4277a083ecd2c8 Patrick McHardy 2006-03-20 2079 kfree(listeners); > 90ae404765d263 Markus Elfring 2023-12-31 2080 out_netlink_release_sock: > 9dfbec1fb2bedf Denis V. Lunev 2008-02-29 2081 netlink_kernel_release(sk); > 23fe18669e7fda Pavel Emelyanov 2008-01-30 2082 return NULL; How do you think about to use the function call “netlink_kernel_release(sock->sk)”? Regards, Markus