From: kernel test robot <lkp@intel.com>
To: Jon Hunter <jonathanh@nvidia.com>
Cc: kbuild-all@lists.01.org, linux-kernel@vger.kernel.org,
Thierry Reding <treding@nvidia.com>
Subject: drivers/firmware/tegra/bpmp-debugfs.c:422:4: warning: 'strncat' output truncated before terminating nul copying as many bytes from a string as its length
Date: Thu, 20 Aug 2020 22:36:23 +0800 [thread overview]
Message-ID: <202008202219.2AewC7yL%lkp@intel.com> (raw)
[-- Attachment #1: Type: text/plain, Size: 3977 bytes --]
Hi Jon,
FYI, the error/warning still remains.
tree: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git master
head: 7eac66d0456fe12a462e5c14c68e97c7460989da
commit: 5e37b9c137ee5a3a9dc2815ca51f71746c2609a6 firmware: tegra: Add support for in-band debug
date: 5 weeks ago
config: arm64-randconfig-r012-20200820 (attached as .config)
compiler: aarch64-linux-gcc (GCC) 9.3.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
git checkout 5e37b9c137ee5a3a9dc2815ca51f71746c2609a6
# save the attached .config to linux build tree
COMPILER_INSTALL_PATH=$HOME/0day COMPILER=gcc-9.3.0 make.cross ARCH=arm64
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 >>):
drivers/firmware/tegra/bpmp-debugfs.c: In function 'bpmp_populate_debugfs_inband':
>> drivers/firmware/tegra/bpmp-debugfs.c:422:4: warning: 'strncat' output truncated before terminating nul copying as many bytes from a string as its length [-Wstringop-truncation]
422 | strncat(pathbuf, name, strlen(name));
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=5e37b9c137ee5a3a9dc2815ca51f71746c2609a6
git remote add linus https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
git fetch --no-tags linus master
git checkout 5e37b9c137ee5a3a9dc2815ca51f71746c2609a6
vim +/strncat +422 drivers/firmware/tegra/bpmp-debugfs.c
364
365 static int bpmp_populate_debugfs_inband(struct tegra_bpmp *bpmp,
366 struct dentry *parent,
367 char *ppath)
368 {
369 const size_t pathlen = SZ_256;
370 const size_t bufsize = SZ_16K;
371 uint32_t dsize, attrs = 0;
372 struct dentry *dentry;
373 struct seqbuf seqbuf;
374 char *buf, *pathbuf;
375 const char *name;
376 int err = 0;
377
378 if (!bpmp || !parent || !ppath)
379 return -EINVAL;
380
381 buf = kmalloc(bufsize, GFP_KERNEL);
382 if (!buf)
383 return -ENOMEM;
384
385 pathbuf = kzalloc(pathlen, GFP_KERNEL);
386 if (!pathbuf) {
387 kfree(buf);
388 return -ENOMEM;
389 }
390
391 err = mrq_debug_read(bpmp, ppath, buf, bufsize, &dsize);
392 if (err)
393 goto out;
394
395 seqbuf_init(&seqbuf, buf, dsize);
396
397 while (!seqbuf_eof(&seqbuf)) {
398 err = seqbuf_read_u32(&seqbuf, &attrs);
399 if (err)
400 goto out;
401
402 err = seqbuf_read_str(&seqbuf, &name);
403 if (err < 0)
404 goto out;
405
406 if (attrs & DEBUGFS_S_ISDIR) {
407 size_t len;
408
409 dentry = debugfs_create_dir(name, parent);
410 if (IS_ERR(dentry)) {
411 err = PTR_ERR(dentry);
412 goto out;
413 }
414
415 len = strlen(ppath) + strlen(name) + 1;
416 if (len >= pathlen) {
417 err = -EINVAL;
418 goto out;
419 }
420
421 strncpy(pathbuf, ppath, pathlen);
> 422 strncat(pathbuf, name, strlen(name));
423 strcat(pathbuf, "/");
424
425 err = bpmp_populate_debugfs_inband(bpmp, dentry,
426 pathbuf);
427 if (err < 0)
428 goto out;
429 } else {
430 umode_t mode;
431
432 mode = attrs & DEBUGFS_S_IRUSR ? 0400 : 0;
433 mode |= attrs & DEBUGFS_S_IWUSR ? 0200 : 0;
434 dentry = debugfs_create_file(name, mode, parent, bpmp,
435 &bpmp_debug_fops);
436 if (!dentry) {
437 err = -ENOMEM;
438 goto out;
439 }
440 }
441 }
442
443 out:
444 kfree(pathbuf);
445 kfree(buf);
446
447 return err;
448 }
449
---
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: 34515 bytes --]
reply other threads:[~2020-08-20 14:37 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
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=202008202219.2AewC7yL%lkp@intel.com \
--to=lkp@intel.com \
--cc=jonathanh@nvidia.com \
--cc=kbuild-all@lists.01.org \
--cc=linux-kernel@vger.kernel.org \
--cc=treding@nvidia.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®