[<prev] [next>] [day] [month] [year] [list]
Message-ID: <202211160358.fLoYYZM6-lkp@intel.com>
Date: Wed, 16 Nov 2022 03:24:50 +0800
From: kernel test robot <lkp@...el.com>
To: Ilya Leoshkevich <iii@...ux.ibm.com>
Cc: oe-kbuild-all@...ts.linux.dev, linux-kernel@...r.kernel.org,
Heiko Carstens <hca@...ux.ibm.com>
Subject: include/linux/seq_file.h:247:9: warning: 'strncpy' output may be
truncated copying 4 bytes from a string of length 4
Hi Ilya,
FYI, the error/warning still remains.
tree: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git master
head: 81e7cfa3a9eb4ba6993a9c71772fdab21bc5d870
commit: e37b3dd063a1a68e28a7cfaf77c84c472112e330 s390: enable KCSAN
date: 1 year, 4 months ago
config: s390-randconfig-r022-20221115
compiler: s390-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=e37b3dd063a1a68e28a7cfaf77c84c472112e330
git remote add linus https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
git fetch --no-tags linus master
git checkout e37b3dd063a1a68e28a7cfaf77c84c472112e330
# 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=s390 SHELL=/bin/bash fs/ocfs2/
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 file included from include/linux/seq_file_net.h:5,
from include/net/net_namespace.h:179,
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:247:9: warning: 'strncpy' output may be truncated copying 4 bytes from a string of length 4 [-Wstringop-truncation]
247 | 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,
| ^~~~~~~~~~~~~~~~~
vim +/strncpy +247 include/linux/seq_file.h
a068acf2ee7769 Kees Cook 2015-09-04 233
a068acf2ee7769 Kees Cook 2015-09-04 234 /**
a068acf2ee7769 Kees Cook 2015-09-04 235 * seq_show_option_n - display mount options with appropriate escapes
a068acf2ee7769 Kees Cook 2015-09-04 236 * where @value must be a specific length.
a068acf2ee7769 Kees Cook 2015-09-04 237 * @m: the seq_file handle
a068acf2ee7769 Kees Cook 2015-09-04 238 * @name: the mount option name
a068acf2ee7769 Kees Cook 2015-09-04 239 * @value: the mount option name's value, cannot be NULL
a068acf2ee7769 Kees Cook 2015-09-04 240 * @length: the length of @value to display
a068acf2ee7769 Kees Cook 2015-09-04 241 *
a068acf2ee7769 Kees Cook 2015-09-04 242 * This is a macro since this uses "length" to define the size of the
a068acf2ee7769 Kees Cook 2015-09-04 243 * stack buffer.
a068acf2ee7769 Kees Cook 2015-09-04 244 */
a068acf2ee7769 Kees Cook 2015-09-04 245 #define seq_show_option_n(m, name, value, length) { \
a068acf2ee7769 Kees Cook 2015-09-04 246 char val_buf[length + 1]; \
a068acf2ee7769 Kees Cook 2015-09-04 @247 strncpy(val_buf, value, length); \
a068acf2ee7769 Kees Cook 2015-09-04 248 val_buf[length] = '\0'; \
a068acf2ee7769 Kees Cook 2015-09-04 249 seq_show_option(m, name, val_buf); \
a068acf2ee7769 Kees Cook 2015-09-04 250 }
a068acf2ee7769 Kees Cook 2015-09-04 251
:::::: The code at line 247 was first introduced by commit
:::::: a068acf2ee77693e0bf39d6e07139ba704f461c3 fs: create and use seq_show_option for escaping
:::::: TO: Kees Cook <keescook@...omium.org>
:::::: CC: Linus Torvalds <torvalds@...ux-foundation.org>
--
0-DAY CI Kernel Test Service
https://01.org/lkp
View attachment "config" of type "text/plain" (80625 bytes)
Powered by blists - more mailing lists