linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* drivers/nvme/target/trace.h:56:9: warning: 'strncpy' specified bound depends on the length of the source argument
@ 2021-08-13 15:27 kernel test robot
  0 siblings, 0 replies; 2+ messages in thread
From: kernel test robot @ 2021-08-13 15:27 UTC (permalink / raw)
  To: Chaitanya Kulkarni; +Cc: kbuild-all, linux-kernel, Christoph Hellwig

[-- Attachment #1: Type: text/plain, Size: 4996 bytes --]

tree:   https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git master
head:   f8e6dfc64f6135d1b6c5215c14cd30b9b60a0008
commit: d86481e924a7d6e8a40477ffa98077c6c0d77ed5 nvmet: use min of device_path and disk len
date:   6 months ago
config: powerpc-randconfig-c023-20210812 (attached as .config)
compiler: powerpc-linux-gcc (GCC) 11.2.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=d86481e924a7d6e8a40477ffa98077c6c0d77ed5
        git remote add linus https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
        git fetch --no-tags linus master
        git checkout d86481e924a7d6e8a40477ffa98077c6c0d77ed5
        # save the attached .config to linux build tree
        COMPILER_INSTALL_PATH=$HOME/0day COMPILER=gcc-11.2.0 make.cross ARCH=powerpc 

If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot <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: In function 'trace_event_raw_event_nvmet_req_init':
   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 file included from drivers/nvme/target/core.c:14:
   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)));
         |                 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   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: In function 'trace_event_raw_event_nvmet_req_complete':
   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, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all@lists.01.org

[-- Attachment #2: .config.gz --]
[-- Type: application/gzip, Size: 41561 bytes --]

^ permalink raw reply	[flat|nested] 2+ messages in thread

* drivers/nvme/target/trace.h:56:9: warning: 'strncpy' specified bound depends on the length of the source argument
@ 2024-01-09 21:43 kernel test robot
  0 siblings, 0 replies; 2+ messages in thread
From: kernel test robot @ 2024-01-09 21:43 UTC (permalink / raw)
  To: Chaitanya Kulkarni; +Cc: oe-kbuild-all, linux-kernel, Christoph Hellwig

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@intel.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

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2024-01-09 21:43 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-08-13 15:27 drivers/nvme/target/trace.h:56:9: warning: 'strncpy' specified bound depends on the length of the source argument kernel test robot
2024-01-09 21:43 kernel test robot

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).