Re: [PATCH net-next 1/2] netdev-genl: Add ifname for queue and NAPI APIs

From: kernel test robot
Date: Thu Feb 22 2024 - 15:56:44 EST


Hi Joe,

kernel test robot noticed the following build warnings:

[auto build test WARNING on net-next/main]

url: https://github.com/intel-lab-lkp/linux/commits/Joe-Damato/netdev-genl-Add-ifname-for-queue-and-NAPI-APIs/20240222-000134
base: net-next/main
patch link: https://lore.kernel.org/r/1708531057-67392-2-git-send-email-jdamato%40fastly.com
patch subject: [PATCH net-next 1/2] netdev-genl: Add ifname for queue and NAPI APIs
config: powerpc-acadia_defconfig (https://download.01.org/0day-ci/archive/20240223/202402230429.g2qC2zMK-lkp@xxxxxxxxx/config)
compiler: clang version 19.0.0git (https://github.com/llvm/llvm-project edd4aee4dd9b5b98b2576a6f783e4086173d902a)
reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20240223/202402230429.g2qC2zMK-lkp@xxxxxxxxx/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 <lkp@xxxxxxxxx>
| Closes: https://lore.kernel.org/oe-kbuild-all/202402230429.g2qC2zMK-lkp@xxxxxxxxx/

All warnings (new ones prefixed by >>):

>> net/core/netdev-genl.c:388:14: warning: variable 'ifname' is uninitialized when used here [-Wuninitialized]
388 | nla_strscpy(ifname, info->attrs[NETDEV_A_QUEUE_IFNAME], IFNAMSIZ);
| ^~~~~~
net/core/netdev-genl.c:376:14: note: initialize the variable 'ifname' to silence this warning
376 | char *ifname;
| ^
| = NULL
1 warning generated.


vim +/ifname +388 net/core/netdev-genl.c

370
371 int netdev_nl_queue_get_doit(struct sk_buff *skb, struct genl_info *info)
372 {
373 u32 q_id, q_type, ifindex;
374 struct net_device *netdev;
375 struct sk_buff *rsp;
376 char *ifname;
377 int err;
378
379 if (GENL_REQ_ATTR_CHECK(info, NETDEV_A_QUEUE_ID) ||
380 GENL_REQ_ATTR_CHECK(info, NETDEV_A_QUEUE_TYPE) ||
381 GENL_REQ_ATTR_CHECK(info, NETDEV_A_QUEUE_IFINDEX) ||
382 GENL_REQ_ATTR_CHECK(info, NETDEV_A_QUEUE_IFNAME))
383 return -EINVAL;
384
385 q_id = nla_get_u32(info->attrs[NETDEV_A_QUEUE_ID]);
386 q_type = nla_get_u32(info->attrs[NETDEV_A_QUEUE_TYPE]);
387 ifindex = nla_get_u32(info->attrs[NETDEV_A_QUEUE_IFINDEX]);
> 388 nla_strscpy(ifname, info->attrs[NETDEV_A_QUEUE_IFNAME], IFNAMSIZ);
389
390 rsp = genlmsg_new(GENLMSG_DEFAULT_SIZE, GFP_KERNEL);
391 if (!rsp)
392 return -ENOMEM;
393
394 rtnl_lock();
395
396 netdev = __dev_get_by_index(genl_info_net(info), ifindex);
397
398 if (strcmp(netdev->name, ifname)) {
399 err = -ENODEV;
400 } else {
401 if (netdev)
402 err = netdev_nl_queue_fill(rsp, netdev, q_id, q_type, info);
403 else
404 err = -ENODEV;
405 }
406
407 rtnl_unlock();
408
409 if (err)
410 goto err_free_msg;
411
412 return genlmsg_reply(rsp, info);
413
414 err_free_msg:
415 nlmsg_free(rsp);
416 return err;
417 }
418

--
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests/wiki