Messages in this thread | | | Date | Mon, 17 Jan 2022 04:33:03 +0800 | From | kernel test robot <> | Subject | include/linux/seq_file.h:262:9: warning: 'strncpy' output may be truncated copying 4 bytes from a string of length 4 |
| |
tree: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git master head: 79e06c4c4950be2abd8ca5d2428a8c915aa62c24 commit: dd03762ab608e058c8f390ad9cf667e490089796 arm64: Enable KCSAN date: 5 weeks ago config: arm64-buildonly-randconfig-r001-20220116 (https://download.01.org/0day-ci/archive/20220117/202201170456.6rWV7FEz-lkp@intel.com/config) compiler: aarch64-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=dd03762ab608e058c8f390ad9cf667e490089796 git remote add linus https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git git fetch --no-tags linus master git checkout dd03762ab608e058c8f390ad9cf667e490089796 # save the config file to linux build tree mkdir build_dir COMPILER_INSTALL_PATH=$HOME/0day COMPILER=gcc-11.2.0 make.cross O=build_dir ARCH=arm64 SHELL=/bin/bash drivers/char/ipmi/ drivers/pci/controller/ fs/ocfs2/
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 include/linux/seq_file_net.h:5, from include/net/net_namespace.h:181, from include/linux/inet.h:42, from fs/ocfs2/super.c:21: fs/ocfs2/super.c: In function 'ocfs2_show_options': >> include/linux/seq_file.h:262:9: warning: 'strncpy' output may be truncated copying 4 bytes from a string of length 4 [-Wstringop-truncation] 262 | strncpy(val_buf, value, length); \ | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ fs/ocfs2/super.c:1539:17: note: in expansion of macro 'seq_show_option_n' 1539 | seq_show_option_n(s, "cluster_stack", osb->osb_cluster_stack, | ^~~~~~~~~~~~~~~~~ -- drivers/char/ipmi/ipmi_msghandler.c: In function 'send_panic_events': >> drivers/char/ipmi/ipmi_msghandler.c:5283:17: warning: 'strncpy' specified bound 11 equals destination size [-Wstringop-truncation] 5283 | strncpy(data+5, p, 11); | ^~~~~~~~~~~~~~~~~~~~~~
vim +/strncpy +262 include/linux/seq_file.h
a068acf2ee77693 Kees Cook 2015-09-04 248 a068acf2ee77693 Kees Cook 2015-09-04 249 /** a068acf2ee77693 Kees Cook 2015-09-04 250 * seq_show_option_n - display mount options with appropriate escapes a068acf2ee77693 Kees Cook 2015-09-04 251 * where @value must be a specific length. a068acf2ee77693 Kees Cook 2015-09-04 252 * @m: the seq_file handle a068acf2ee77693 Kees Cook 2015-09-04 253 * @name: the mount option name a068acf2ee77693 Kees Cook 2015-09-04 254 * @value: the mount option name's value, cannot be NULL a068acf2ee77693 Kees Cook 2015-09-04 255 * @length: the length of @value to display a068acf2ee77693 Kees Cook 2015-09-04 256 * a068acf2ee77693 Kees Cook 2015-09-04 257 * This is a macro since this uses "length" to define the size of the a068acf2ee77693 Kees Cook 2015-09-04 258 * stack buffer. a068acf2ee77693 Kees Cook 2015-09-04 259 */ a068acf2ee77693 Kees Cook 2015-09-04 260 #define seq_show_option_n(m, name, value, length) { \ a068acf2ee77693 Kees Cook 2015-09-04 261 char val_buf[length + 1]; \ a068acf2ee77693 Kees Cook 2015-09-04 @262 strncpy(val_buf, value, length); \ a068acf2ee77693 Kees Cook 2015-09-04 263 val_buf[length] = '\0'; \ a068acf2ee77693 Kees Cook 2015-09-04 264 seq_show_option(m, name, val_buf); \ a068acf2ee77693 Kees Cook 2015-09-04 265 } a068acf2ee77693 Kees Cook 2015-09-04 266
:::::: The code at line 262 was first introduced by commit :::::: a068acf2ee77693e0bf39d6e07139ba704f461c3 fs: create and use seq_show_option for escaping
:::::: TO: Kees Cook <keescook@chromium.org> :::::: CC: Linus Torvalds <torvalds@linux-foundation.org>
--- 0-DAY CI Kernel Test Service, Intel Corporation https://lists.01.org/hyperkitty/list/kbuild-all@lists.01.org
| |