From: kernel test robot <lkp@intel.com>
To: Rohan McLure <rmclure@linux.ibm.com>
Cc: oe-kbuild-all@lists.linux.dev, linux-kernel@vger.kernel.org,
Michael Ellerman <mpe@ellerman.id.au>,
Christophe Leroy <christophe.leroy@csgroup.eu>
Subject: include/linux/seq_file.h:263:9: warning: 'strncpy' output may be truncated copying 4 bytes from a string of length 4
Date: Tue, 25 Jul 2023 19:24:46 +0800 [thread overview]
Message-ID: <202307251906.lXcLGKvG-lkp@intel.com> (raw)
Hi Rohan,
FYI, the error/warning was bisected to this commit, please ignore it if it's irrelevant.
tree: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git master
head: 0b5547c51827e053cc754db47d3ec3e6c2c451d2
commit: 95567f46b4d20c047750a5e3029461afcdc67697 powerpc/{32,book3e}: kcsan: Extend KCSAN Support
date: 7 weeks ago
config: powerpc-randconfig-r015-20230725 (https://download.01.org/0day-ci/archive/20230725/202307251906.lXcLGKvG-lkp@intel.com/config)
compiler: powerpc-linux-gcc (GCC) 12.3.0
reproduce: (https://download.01.org/0day-ci/archive/20230725/202307251906.lXcLGKvG-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/202307251906.lXcLGKvG-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:193,
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:263:9: warning: 'strncpy' output may be truncated copying 4 bytes from a string of length 4 [-Wstringop-truncation]
263 | strncpy(val_buf, value, length); \
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
fs/ocfs2/super.c:1518:17: note: in expansion of macro 'seq_show_option_n'
1518 | seq_show_option_n(s, "cluster_stack", osb->osb_cluster_stack,
| ^~~~~~~~~~~~~~~~~
vim +/strncpy +263 include/linux/seq_file.h
a068acf2ee7769 Kees Cook 2015-09-04 249
a068acf2ee7769 Kees Cook 2015-09-04 250 /**
a068acf2ee7769 Kees Cook 2015-09-04 251 * seq_show_option_n - display mount options with appropriate escapes
a068acf2ee7769 Kees Cook 2015-09-04 252 * where @value must be a specific length.
a068acf2ee7769 Kees Cook 2015-09-04 253 * @m: the seq_file handle
a068acf2ee7769 Kees Cook 2015-09-04 254 * @name: the mount option name
a068acf2ee7769 Kees Cook 2015-09-04 255 * @value: the mount option name's value, cannot be NULL
a068acf2ee7769 Kees Cook 2015-09-04 256 * @length: the length of @value to display
a068acf2ee7769 Kees Cook 2015-09-04 257 *
a068acf2ee7769 Kees Cook 2015-09-04 258 * This is a macro since this uses "length" to define the size of the
a068acf2ee7769 Kees Cook 2015-09-04 259 * stack buffer.
a068acf2ee7769 Kees Cook 2015-09-04 260 */
a068acf2ee7769 Kees Cook 2015-09-04 261 #define seq_show_option_n(m, name, value, length) { \
a068acf2ee7769 Kees Cook 2015-09-04 262 char val_buf[length + 1]; \
a068acf2ee7769 Kees Cook 2015-09-04 @263 strncpy(val_buf, value, length); \
a068acf2ee7769 Kees Cook 2015-09-04 264 val_buf[length] = '\0'; \
a068acf2ee7769 Kees Cook 2015-09-04 265 seq_show_option(m, name, val_buf); \
a068acf2ee7769 Kees Cook 2015-09-04 266 }
a068acf2ee7769 Kees Cook 2015-09-04 267
:::::: The code at line 263 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
https://github.com/intel/lkp-tests/wiki
next reply other threads:[~2023-07-25 11:25 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-07-25 11:24 kernel test robot [this message]
2023-08-09 8:15 ` Christophe Leroy
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=202307251906.lXcLGKvG-lkp@intel.com \
--to=lkp@intel.com \
--cc=christophe.leroy@csgroup.eu \
--cc=linux-kernel@vger.kernel.org \
--cc=mpe@ellerman.id.au \
--cc=oe-kbuild-all@lists.linux.dev \
--cc=rmclure@linux.ibm.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®