Re: [PATCH net-next v2 6/8] net: netconsole: cache userdata formatted string in netconsole_target

From: kernel test robot
Date: Sat Jan 27 2024 - 08:16:07 EST


Hi Matthew,

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/Matthew-Wood/net-netconsole-cleanup-formatting-lints/20240127-072017
base: net-next/main
patch link: https://lore.kernel.org/r/20240126231348.281600-7-thepacketgeek%40gmail.com
patch subject: [PATCH net-next v2 6/8] net: netconsole: cache userdata formatted string in netconsole_target
config: x86_64-kexec (https://download.01.org/0day-ci/archive/20240127/202401272022.r5Z4OtUg-lkp@xxxxxxxxx/config)
compiler: gcc-12 (Debian 12.2.0-14) 12.2.0
reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20240127/202401272022.r5Z4OtUg-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/202401272022.r5Z4OtUg-lkp@xxxxxxxxx/

All warnings (new ones prefixed by >>):

drivers/net/netconsole.c: In function 'update_userdata':
>> drivers/net/netconsole.c:649:26: warning: variable 'ud' set but not used [-Wunused-but-set-variable]
649 | struct userdata *ud;
| ^~


vim +/ud +649 drivers/net/netconsole.c

644
645 static void update_userdata(struct netconsole_target *nt)
646 {
647 int complete_idx = 0, child_count = 0;
648 struct list_head *entry;
> 649 struct userdata *ud;
650
651 /* Clear the current string in case the last userdatum was deleted */
652 nt->userdata_length = 0;
653 nt->userdata_complete[0] = 0;
654
655 ud = to_userdata(&nt->userdata_group.cg_item);
656 list_for_each(entry, &nt->userdata_group.cg_children) {
657 struct userdatum *udm_item;
658 struct config_item *item;
659
660 if (child_count >= MAX_USERDATA_ITEMS)
661 break;
662 child_count++;
663
664 item = container_of(entry, struct config_item, ci_entry);
665 udm_item = to_userdatum(item);
666
667 /* Skip userdata with no value set */
668 if (strnlen(udm_item->value, MAX_USERDATA_VALUE_LENGTH) == 0)
669 continue;
670
671 /* This doesn't overflow userdata_complete since it will write
672 * one entry length (1/MAX_USERDATA_ITEMS long), entry count is
673 * checked to not exceed MAX items with child_count above
674 */
675 complete_idx += scnprintf(&nt->userdata_complete[complete_idx],
676 MAX_USERDATA_ENTRY_LENGTH, "%s=%s\n",
677 item->ci_name, udm_item->value);
678 }
679 nt->userdata_length = strnlen(nt->userdata_complete,
680 sizeof(nt->userdata_complete));
681 }
682

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