Re: [PATCH v1 net 1/3] gtp: Use for_each_netdev_rcu() in gtp_genl_dump_pdp().
From: kernel test robot <hidden>
Date: 2025-01-10 02:39:13
Also in:
llvm, oe-kbuild-all
Hi Kuniyuki, kernel test robot noticed the following build warnings: [auto build test WARNING on net/main] url: https://github.com/intel-lab-lkp/linux/commits/Kuniyuki-Iwashima/gtp-Use-for_each_netdev_rcu-in-gtp_genl_dump_pdp/20250108-143107 base: net/main patch link: https://lore.kernel.org/r/20250108062834.11117-2-kuniyu%40amazon.com patch subject: [PATCH v1 net 1/3] gtp: Use for_each_netdev_rcu() in gtp_genl_dump_pdp(). config: arm64-allmodconfig (https://download.01.org/0day-ci/archive/20250110/202501101052.pULMpd2R-lkp@intel.com/config) compiler: clang version 18.1.8 (https://github.com/llvm/llvm-project 3b5b5c1ec4a3095ab096dd780e84d7ab81f3d7ff) reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20250110/202501101052.pULMpd2R-lkp@intel.com/reproduce) If you fix the issue in a separate patch/commit (i.e. not just a new version of the same patch/commit), kindly add following tags | Reported-by: kernel test robot [off-list ref] | Closes: https://lore.kernel.org/oe-kbuild-all/202501101052.pULMpd2R-lkp@intel.com/ (local) All warnings (new ones prefixed by >>): drivers/net/gtp.c:2276:18: warning: variable 'gn' set but not used [-Wunused-but-set-variable] 2276 | struct gtp_net *gn; | ^
quoted
drivers/net/gtp.c:2288:31: warning: variable 'gtp' is uninitialized when used here [-Wuninitialized]
2288 | if (last_gtp && last_gtp != gtp)
| ^~~
drivers/net/gtp.c:2271:64: note: initialize the variable 'gtp' to silence this warning
2271 | struct gtp_dev *last_gtp = (struct gtp_dev *)cb->args[2], *gtp;
| ^
| = NULL
2 warnings generated.
vim +/gtp +2288 drivers/net/gtp.c
459aa660eb1d8c Pablo Neira 2016-05-09 2267
459aa660eb1d8c Pablo Neira 2016-05-09 2268 static int gtp_genl_dump_pdp(struct sk_buff *skb,
459aa660eb1d8c Pablo Neira 2016-05-09 2269 struct netlink_callback *cb)
459aa660eb1d8c Pablo Neira 2016-05-09 2270 {
459aa660eb1d8c Pablo Neira 2016-05-09 2271 struct gtp_dev *last_gtp = (struct gtp_dev *)cb->args[2], *gtp;
94a6d9fb88df43 Taehee Yoo 2019-12-11 2272 int i, j, bucket = cb->args[0], skip = cb->args[1];
459aa660eb1d8c Pablo Neira 2016-05-09 2273 struct net *net = sock_net(skb->sk);
766a8e9a311068 Kuniyuki Iwashima 2025-01-08 2274 struct net_device *dev;
459aa660eb1d8c Pablo Neira 2016-05-09 2275 struct pdp_ctx *pctx;
94a6d9fb88df43 Taehee Yoo 2019-12-11 2276 struct gtp_net *gn;
94a6d9fb88df43 Taehee Yoo 2019-12-11 2277
94a6d9fb88df43 Taehee Yoo 2019-12-11 2278 gn = net_generic(net, gtp_net_id);
459aa660eb1d8c Pablo Neira 2016-05-09 2279
459aa660eb1d8c Pablo Neira 2016-05-09 2280 if (cb->args[4])
459aa660eb1d8c Pablo Neira 2016-05-09 2281 return 0;
459aa660eb1d8c Pablo Neira 2016-05-09 2282
94a6d9fb88df43 Taehee Yoo 2019-12-11 2283 rcu_read_lock();
766a8e9a311068 Kuniyuki Iwashima 2025-01-08 2284 for_each_netdev_rcu(net, dev) {
766a8e9a311068 Kuniyuki Iwashima 2025-01-08 2285 if (dev->rtnl_link_ops != >p_link_ops)
766a8e9a311068 Kuniyuki Iwashima 2025-01-08 2286 continue;
766a8e9a311068 Kuniyuki Iwashima 2025-01-08 2287
459aa660eb1d8c Pablo Neira 2016-05-09 @2288 if (last_gtp && last_gtp != gtp)
459aa660eb1d8c Pablo Neira 2016-05-09 2289 continue;
459aa660eb1d8c Pablo Neira 2016-05-09 2290 else
459aa660eb1d8c Pablo Neira 2016-05-09 2291 last_gtp = NULL;
459aa660eb1d8c Pablo Neira 2016-05-09 2292
94a6d9fb88df43 Taehee Yoo 2019-12-11 2293 for (i = bucket; i < gtp->hash_size; i++) {
94a6d9fb88df43 Taehee Yoo 2019-12-11 2294 j = 0;
94a6d9fb88df43 Taehee Yoo 2019-12-11 2295 hlist_for_each_entry_rcu(pctx, >p->tid_hash[i],
94a6d9fb88df43 Taehee Yoo 2019-12-11 2296 hlist_tid) {
94a6d9fb88df43 Taehee Yoo 2019-12-11 2297 if (j >= skip &&
94a6d9fb88df43 Taehee Yoo 2019-12-11 2298 gtp_genl_fill_info(skb,
459aa660eb1d8c Pablo Neira 2016-05-09 2299 NETLINK_CB(cb->skb).portid,
459aa660eb1d8c Pablo Neira 2016-05-09 2300 cb->nlh->nlmsg_seq,
846c68f7f1ac82 Yoshiyuki Kurauchi 2020-04-30 2301 NLM_F_MULTI,
94a6d9fb88df43 Taehee Yoo 2019-12-11 2302 cb->nlh->nlmsg_type, pctx)) {
459aa660eb1d8c Pablo Neira 2016-05-09 2303 cb->args[0] = i;
94a6d9fb88df43 Taehee Yoo 2019-12-11 2304 cb->args[1] = j;
459aa660eb1d8c Pablo Neira 2016-05-09 2305 cb->args[2] = (unsigned long)gtp;
459aa660eb1d8c Pablo Neira 2016-05-09 2306 goto out;
459aa660eb1d8c Pablo Neira 2016-05-09 2307 }
94a6d9fb88df43 Taehee Yoo 2019-12-11 2308 j++;
459aa660eb1d8c Pablo Neira 2016-05-09 2309 }
94a6d9fb88df43 Taehee Yoo 2019-12-11 2310 skip = 0;
459aa660eb1d8c Pablo Neira 2016-05-09 2311 }
94a6d9fb88df43 Taehee Yoo 2019-12-11 2312 bucket = 0;
459aa660eb1d8c Pablo Neira 2016-05-09 2313 }
459aa660eb1d8c Pablo Neira 2016-05-09 2314 cb->args[4] = 1;
459aa660eb1d8c Pablo Neira 2016-05-09 2315 out:
94a6d9fb88df43 Taehee Yoo 2019-12-11 2316 rcu_read_unlock();
459aa660eb1d8c Pablo Neira 2016-05-09 2317 return skb->len;
459aa660eb1d8c Pablo Neira 2016-05-09 2318 }
459aa660eb1d8c Pablo Neira 2016-05-09 2319
--
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests/wiki