lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [day] [month] [year] [list]
Message-ID: <202403290419.HPcyvqZu-lkp@intel.com>
Date: Fri, 29 Mar 2024 05:06:49 +0800
From: kernel test robot <lkp@...el.com>
To: "Darrick J. Wong" <djwong@...nel.org>
Cc: oe-kbuild-all@...ts.linux.dev, linux-kernel@...r.kernel.org,
	Kent Overstreet <kent.overstreet@...ux.dev>,
	Dave Chinner <dchinner@...hat.com>
Subject: fs/xfs/./scrub/trace.h:748:3: warning: 'strncpy' specified bound 256
 equals destination size

tree:   https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git master
head:   8d025e2092e29bfd13e56c78e22af25fac83c8ec
commit: 3934e8ebb7cc6e5f1ade35d586ed3eb79b88eb95 xfs: create a big array data structure
date:   8 months ago
config: x86_64-buildonly-randconfig-005-20240328 (https://download.01.org/0day-ci/archive/20240329/202403290419.HPcyvqZu-lkp@intel.com/config)
compiler: gcc-8 (Ubuntu 8.4.0-3ubuntu2) 8.4.0
reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20240329/202403290419.HPcyvqZu-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/202403290419.HPcyvqZu-lkp@intel.com/

All warnings (new ones prefixed by >>):

   In file included from include/trace/define_trace.h:103,
                    from fs/xfs/scrub/trace.h:1119,
                    from fs/xfs/scrub/trace.c:42:
   fs/xfs/./scrub/trace.h: In function 'perf_trace_xfile_create':
>> fs/xfs/./scrub/trace.h:748:3: warning: 'strncpy' specified bound 256 equals destination size [-Wstringop-truncation]
      strncpy(__entry->pathname, path, sizeof(__entry->pathname));
      ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   include/trace/perf.h:51:4: note: in definition of macro 'DECLARE_EVENT_CLASS'
     { assign; }       \
       ^~~~~~
   include/trace/trace_events.h:44:9: note: in expansion of macro 'PARAMS'
            PARAMS(assign),         \
            ^~~~~~
   fs/xfs/./scrub/trace.h:731:1: note: in expansion of macro 'TRACE_EVENT'
    TRACE_EVENT(xfile_create,
    ^~~~~~~~~~~
   fs/xfs/./scrub/trace.h:739:2: note: in expansion of macro 'TP_fast_assign'
     TP_fast_assign(
     ^~~~~~~~~~~~~~
   In file included from include/trace/define_trace.h:102,
                    from fs/xfs/scrub/trace.h:1119,
                    from fs/xfs/scrub/trace.c:42:
   fs/xfs/./scrub/trace.h: In function 'trace_event_raw_event_xfile_create':
>> fs/xfs/./scrub/trace.h:748:3: warning: 'strncpy' specified bound 256 equals destination size [-Wstringop-truncation]
      strncpy(__entry->pathname, path, sizeof(__entry->pathname));
      ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   include/trace/trace_events.h:402:4: note: in definition of macro 'DECLARE_EVENT_CLASS'
     { assign; }       \
       ^~~~~~
   include/trace/trace_events.h:44:9: note: in expansion of macro 'PARAMS'
            PARAMS(assign),         \
            ^~~~~~
   fs/xfs/./scrub/trace.h:731:1: note: in expansion of macro 'TRACE_EVENT'
    TRACE_EVENT(xfile_create,
    ^~~~~~~~~~~
   fs/xfs/./scrub/trace.h:739:2: note: in expansion of macro 'TP_fast_assign'
     TP_fast_assign(
     ^~~~~~~~~~~~~~


vim +/strncpy +748 fs/xfs/./scrub/trace.h

   730	
   731	TRACE_EVENT(xfile_create,
   732		TP_PROTO(struct xfile *xf),
   733		TP_ARGS(xf),
   734		TP_STRUCT__entry(
   735			__field(dev_t, dev)
   736			__field(unsigned long, ino)
   737			__array(char, pathname, 256)
   738		),
   739		TP_fast_assign(
   740			char		pathname[257];
   741			char		*path;
   742	
   743			__entry->ino = file_inode(xf->file)->i_ino;
   744			memset(pathname, 0, sizeof(pathname));
   745			path = file_path(xf->file, pathname, sizeof(pathname) - 1);
   746			if (IS_ERR(path))
   747				path = "(unknown)";
 > 748			strncpy(__entry->pathname, path, sizeof(__entry->pathname));
   749		),
   750		TP_printk("xfino 0x%lx path '%s'",
   751			  __entry->ino,
   752			  __entry->pathname)
   753	);
   754	

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

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ