[<prev] [next>] [day] [month] [year] [list]
Message-ID: <202210130636.lVOraCXx-lkp@intel.com>
Date: Thu, 13 Oct 2022 06:56:29 +0800
From: kernel test robot <lkp@...el.com>
To: Jian Shen <shenjian15@...wei.com>
Cc: kbuild-all@...ts.01.org, linux-kernel@...r.kernel.org,
Jakub Kicinski <kuba@...nel.org>,
Huazhong Tan <tanhuazhong@...wei.com>
Subject: drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_debugfs.c:90:25:
warning: 'strncpy' output truncated before terminating nul copying as many
bytes from a string as its length
Hi Jian,
FYI, the error/warning still remains.
tree: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git master
head: 1440f576022887004f719883acb094e7e0dd4944
commit: 0ca821da86a5ec24eb2ece24fe87e5bf518c5939 net: hns3: add debugfs support for vlan configuration
date: 1 year, 4 months ago
config: csky-allyesconfig
compiler: csky-linux-gcc (GCC) 12.1.0
reproduce (this is a W=1 build):
wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross
chmod +x ~/bin/make.cross
# https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=0ca821da86a5ec24eb2ece24fe87e5bf518c5939
git remote add linus https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
git fetch --no-tags linus master
git checkout 0ca821da86a5ec24eb2ece24fe87e5bf518c5939
# save the config file
mkdir build_dir && cp config build_dir/.config
COMPILER_INSTALL_PATH=$HOME/0day COMPILER=gcc-12.1.0 make.cross W=1 O=build_dir ARCH=csky SHELL=/bin/bash drivers/net/ethernet/hisilicon/hns3/hns3pf/
If you fix the issue, kindly add following tag where applicable
| Reported-by: kernel test robot <lkp@...el.com>
All warnings (new ones prefixed by >>):
In function 'hclge_dbg_fill_content',
inlined from 'hclge_dbg_dump_vlan_filter_config.constprop' at drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_debugfs.c:2080:2:
drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_debugfs.c:92:25: warning: 'strncpy' specified bound depends on the length of the source argument [-Wstringop-truncation]
92 | strncpy(pos, items[i].name, strlen(items[i].name));
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
In function 'hclge_dbg_fill_content',
inlined from 'hclge_dbg_dump_vlan_filter_config.constprop' at drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_debugfs.c:2102:3:
>> drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_debugfs.c:90:25: warning: 'strncpy' output truncated before terminating nul copying as many bytes from a string as its length [-Wstringop-truncation]
90 | strncpy(pos, result[i], strlen(result[i]));
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
In function 'hclge_dbg_fill_content',
inlined from 'hclge_dbg_dump_mac_list' at drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_debugfs.c:1872:2:
drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_debugfs.c:92:25: warning: 'strncpy' specified bound depends on the length of the source argument [-Wstringop-truncation]
92 | strncpy(pos, items[i].name, strlen(items[i].name));
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
In function 'hclge_dbg_fill_content',
inlined from 'hclge_dbg_dump_mac_list' at drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_debugfs.c:1887:4:
drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_debugfs.c:90:25: warning: 'strncpy' specified bound depends on the length of the source argument [-Wstringop-truncation]
90 | strncpy(pos, result[i], strlen(result[i]));
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
In function 'hclge_dbg_fill_content',
inlined from 'hclge_dbg_dump_tm_pg' at drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_debugfs.c:735:2:
drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_debugfs.c:92:25: warning: 'strncpy' specified bound depends on the length of the source argument [-Wstringop-truncation]
92 | strncpy(pos, items[i].name, strlen(items[i].name));
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
In function 'hclge_dbg_fill_content',
inlined from 'hclge_dbg_dump_tm_pg' at drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_debugfs.c:775:3:
drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_debugfs.c:90:25: warning: 'strncpy' specified bound depends on the length of the source argument [-Wstringop-truncation]
90 | strncpy(pos, result[i], strlen(result[i]));
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
In function 'hclge_dbg_fill_content',
inlined from 'hclge_dbg_dump_tm_qset' at drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_debugfs.c:1027:2:
drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_debugfs.c:92:25: warning: 'strncpy' specified bound depends on the length of the source argument [-Wstringop-truncation]
92 | strncpy(pos, items[i].name, strlen(items[i].name));
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
In function 'hclge_dbg_fill_content',
inlined from 'hclge_dbg_dump_tm_qset' at drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_debugfs.c:1059:3:
drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_debugfs.c:90:25: warning: 'strncpy' specified bound depends on the length of the source argument [-Wstringop-truncation]
90 | strncpy(pos, result[i], strlen(result[i]));
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
In function 'hclge_dbg_fill_content',
inlined from 'hclge_dbg_dump_vlan_offload_config' at drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_debugfs.c:2123:2:
drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_debugfs.c:92:25: warning: 'strncpy' specified bound depends on the length of the source argument [-Wstringop-truncation]
92 | strncpy(pos, items[i].name, strlen(items[i].name));
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
In function 'hclge_dbg_fill_content',
inlined from 'hclge_dbg_dump_vlan_offload_config' at drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_debugfs.c:2154:3:
>> drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_debugfs.c:90:25: warning: 'strncpy' output truncated before terminating nul copying as many bytes from a string as its length [-Wstringop-truncation]
90 | strncpy(pos, result[i], strlen(result[i]));
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Kconfig warnings: (for reference only)
WARNING: unmet direct dependencies detected for LOCKDEP
Depends on [n]: DEBUG_KERNEL [=y] && LOCK_DEBUGGING_SUPPORT [=y] && (FRAME_POINTER [=n] || MIPS || PPC || S390 || MICROBLAZE || ARM || ARC || X86)
Selected by [y]:
- PROVE_LOCKING [=y] && DEBUG_KERNEL [=y] && LOCK_DEBUGGING_SUPPORT [=y]
- LOCK_STAT [=y] && DEBUG_KERNEL [=y] && LOCK_DEBUGGING_SUPPORT [=y]
- DEBUG_LOCK_ALLOC [=y] && DEBUG_KERNEL [=y] && LOCK_DEBUGGING_SUPPORT [=y]
vim +/strncpy +90 drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_debugfs.c
a582b78dfc33d21 Zhongzhu Liu 2019-08-28 79
1556ea9120ffcf4 Huazhong Tan 2021-05-14 80 static void hclge_dbg_fill_content(char *content, u16 len,
1556ea9120ffcf4 Huazhong Tan 2021-05-14 81 const struct hclge_dbg_item *items,
1556ea9120ffcf4 Huazhong Tan 2021-05-14 82 const char **result, u16 size)
1556ea9120ffcf4 Huazhong Tan 2021-05-14 83 {
1556ea9120ffcf4 Huazhong Tan 2021-05-14 84 char *pos = content;
1556ea9120ffcf4 Huazhong Tan 2021-05-14 85 u16 i;
1556ea9120ffcf4 Huazhong Tan 2021-05-14 86
1556ea9120ffcf4 Huazhong Tan 2021-05-14 87 memset(content, ' ', len);
1556ea9120ffcf4 Huazhong Tan 2021-05-14 88 for (i = 0; i < size; i++) {
1556ea9120ffcf4 Huazhong Tan 2021-05-14 89 if (result)
1556ea9120ffcf4 Huazhong Tan 2021-05-14 @90 strncpy(pos, result[i], strlen(result[i]));
1556ea9120ffcf4 Huazhong Tan 2021-05-14 91 else
1556ea9120ffcf4 Huazhong Tan 2021-05-14 92 strncpy(pos, items[i].name, strlen(items[i].name));
1556ea9120ffcf4 Huazhong Tan 2021-05-14 93 pos += strlen(items[i].name) + items[i].interval;
1556ea9120ffcf4 Huazhong Tan 2021-05-14 94 }
1556ea9120ffcf4 Huazhong Tan 2021-05-14 95 *pos++ = '\n';
1556ea9120ffcf4 Huazhong Tan 2021-05-14 96 *pos++ = '\0';
1556ea9120ffcf4 Huazhong Tan 2021-05-14 97 }
1556ea9120ffcf4 Huazhong Tan 2021-05-14 98
:::::: The code at line 90 was first introduced by commit
:::::: 1556ea9120ffcf4faf7ac6b62a6e28216f260a23 net: hns3: refactor dump mac list of debugfs
:::::: TO: Huazhong Tan <tanhuazhong@...wei.com>
:::::: CC: David S. Miller <davem@...emloft.net>
--
0-DAY CI Kernel Test Service
https://01.org/lkp
View attachment "config" of type "text/plain" (288299 bytes)
Powered by blists - more mailing lists