[<prev] [next>] [day] [month] [year] [list]
Message-ID: <202401100527.L7RokChn-lkp@intel.com>
Date: Wed, 10 Jan 2024 05:43:33 +0800
From: kernel test robot <lkp@...el.com>
To: Chaitanya Kulkarni <chaitanya.kulkarni@....com>
Cc: oe-kbuild-all@...ts.linux.dev, linux-kernel@...r.kernel.org,
Christoph Hellwig <hch@....de>
Subject: drivers/nvme/target/trace.h:56:9: warning: 'strncpy' specified bound
depends on the length of the source argument
Hi Chaitanya,
FYI, the error/warning still remains.
tree: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git master
head: 9f8413c4a66f2fb776d3dc3c9ed20bf435eb305e
commit: d86481e924a7d6e8a40477ffa98077c6c0d77ed5 nvmet: use min of device_path and disk len
date: 2 years, 11 months ago
config: arm64-randconfig-002-20240106 (https://download.01.org/0day-ci/archive/20240110/202401100527.L7RokChn-lkp@intel.com/config)
compiler: aarch64-linux-gcc (GCC) 13.2.0
reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20240110/202401100527.L7RokChn-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 <lkp@...el.com>
| Closes: https://lore.kernel.org/oe-kbuild-all/202401100527.L7RokChn-lkp@intel.com/
All warnings (new ones prefixed by >>):
In file included from drivers/nvme/target/core.c:14:
In function '__assign_req_name',
inlined from 'trace_event_raw_event_nvmet_req_init' at drivers/nvme/target/./trace.h:61:1:
>> drivers/nvme/target/trace.h:56:9: warning: 'strncpy' specified bound depends on the length of the source argument [-Wstringop-truncation]
56 | strncpy(name, req->ns->device_path,
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
57 | min_t(size_t, DISK_NAME_LEN, strlen(req->ns->device_path)));
| ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
In file included from include/linux/kernel.h:14,
from include/linux/list.h:9,
from include/linux/module.h:12,
from drivers/nvme/target/core.c:7:
drivers/nvme/target/trace.h:57:46: note: length computed here
57 | min_t(size_t, DISK_NAME_LEN, strlen(req->ns->device_path)));
include/linux/minmax.h:38:39: note: in definition of macro '__cmp_once'
38 | typeof(y) unique_y = (y); \
| ^
include/linux/minmax.h:110:33: note: in expansion of macro '__careful_cmp'
110 | #define min_t(type, x, y) __careful_cmp((type)(x), (type)(y), <)
| ^~~~~~~~~~~~~
drivers/nvme/target/trace.h:57:17: note: in expansion of macro 'min_t'
57 | min_t(size_t, DISK_NAME_LEN, strlen(req->ns->device_path)));
| ^~~~~
In function '__assign_req_name',
inlined from 'trace_event_raw_event_nvmet_req_complete' at drivers/nvme/target/./trace.h:103:1:
>> drivers/nvme/target/trace.h:56:9: warning: 'strncpy' specified bound depends on the length of the source argument [-Wstringop-truncation]
56 | strncpy(name, req->ns->device_path,
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
57 | min_t(size_t, DISK_NAME_LEN, strlen(req->ns->device_path)));
| ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
drivers/nvme/target/trace.h:57:46: note: length computed here
57 | min_t(size_t, DISK_NAME_LEN, strlen(req->ns->device_path)));
include/linux/minmax.h:38:39: note: in definition of macro '__cmp_once'
38 | typeof(y) unique_y = (y); \
| ^
include/linux/minmax.h:110:33: note: in expansion of macro '__careful_cmp'
110 | #define min_t(type, x, y) __careful_cmp((type)(x), (type)(y), <)
| ^~~~~~~~~~~~~
drivers/nvme/target/trace.h:57:17: note: in expansion of macro 'min_t'
57 | min_t(size_t, DISK_NAME_LEN, strlen(req->ns->device_path)));
| ^~~~~
In function '__assign_req_name',
inlined from 'perf_trace_nvmet_req_complete' at drivers/nvme/target/./trace.h:103:1:
>> drivers/nvme/target/trace.h:56:9: warning: 'strncpy' specified bound depends on the length of the source argument [-Wstringop-truncation]
56 | strncpy(name, req->ns->device_path,
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
57 | min_t(size_t, DISK_NAME_LEN, strlen(req->ns->device_path)));
| ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
drivers/nvme/target/trace.h:57:46: note: length computed here
57 | min_t(size_t, DISK_NAME_LEN, strlen(req->ns->device_path)));
include/linux/minmax.h:38:39: note: in definition of macro '__cmp_once'
38 | typeof(y) unique_y = (y); \
| ^
include/linux/minmax.h:110:33: note: in expansion of macro '__careful_cmp'
110 | #define min_t(type, x, y) __careful_cmp((type)(x), (type)(y), <)
| ^~~~~~~~~~~~~
drivers/nvme/target/trace.h:57:17: note: in expansion of macro 'min_t'
57 | min_t(size_t, DISK_NAME_LEN, strlen(req->ns->device_path)));
| ^~~~~
In function '__assign_req_name',
inlined from 'perf_trace_nvmet_req_init' at drivers/nvme/target/./trace.h:61:1:
>> drivers/nvme/target/trace.h:56:9: warning: 'strncpy' specified bound depends on the length of the source argument [-Wstringop-truncation]
56 | strncpy(name, req->ns->device_path,
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
57 | min_t(size_t, DISK_NAME_LEN, strlen(req->ns->device_path)));
| ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
drivers/nvme/target/trace.h:57:46: note: length computed here
57 | min_t(size_t, DISK_NAME_LEN, strlen(req->ns->device_path)));
include/linux/minmax.h:38:39: note: in definition of macro '__cmp_once'
38 | typeof(y) unique_y = (y); \
| ^
include/linux/minmax.h:110:33: note: in expansion of macro '__careful_cmp'
110 | #define min_t(type, x, y) __careful_cmp((type)(x), (type)(y), <)
| ^~~~~~~~~~~~~
drivers/nvme/target/trace.h:57:17: note: in expansion of macro 'min_t'
57 | min_t(size_t, DISK_NAME_LEN, strlen(req->ns->device_path)));
| ^~~~~
vim +/strncpy +56 drivers/nvme/target/trace.h
48
49 static inline void __assign_req_name(char *name, struct nvmet_req *req)
50 {
51 if (!req->ns) {
52 memset(name, 0, DISK_NAME_LEN);
53 return;
54 }
55
> 56 strncpy(name, req->ns->device_path,
57 min_t(size_t, DISK_NAME_LEN, strlen(req->ns->device_path)));
58 }
59 #endif
60
--
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests/wiki
Powered by blists - more mailing lists