All of lore.kernel.org
 help / color / mirror / Atom feed
From: kernel test robot <lkp@intel.com>
To: kbuild-all@lists.01.org
Subject: [bcache:nvdimm-meta 7/16] drivers/md/bcache/nvm-pages.c:138:3: warning: 'strncpy' output truncated before terminating nul copying 16 bytes from a string of the same length
Date: Tue, 30 Mar 2021 03:32:51 +0800	[thread overview]
Message-ID: <202103300345.bEkGAUIW-lkp@intel.com> (raw)

[-- Attachment #1: Type: text/plain, Size: 5372 bytes --]

tree:   https://git.kernel.org/pub/scm/linux/kernel/git/colyli/linux-bcache.git nvdimm-meta
head:   be0f72faa6d269aa7d824296859cd055f0ba61a0
commit: 1c09ce1d2b048fd2b49d2f85c5bb208c65b645b9 [7/16] bcache: use helper routines to get/set bch_pgalloc_rec pgoff and order
config: ia64-allmodconfig (attached as .config)
compiler: ia64-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
        # https://git.kernel.org/pub/scm/linux/kernel/git/colyli/linux-bcache.git/commit/?id=1c09ce1d2b048fd2b49d2f85c5bb208c65b645b9
        git remote add bcache https://git.kernel.org/pub/scm/linux/kernel/git/colyli/linux-bcache.git
        git fetch --no-tags bcache nvdimm-meta
        git checkout 1c09ce1d2b048fd2b49d2f85c5bb208c65b645b9
        # save the attached .config to linux build tree
        COMPILER_INSTALL_PATH=$HOME/0day COMPILER=gcc-9.3.0 make.cross ARCH=ia64 

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 function 'find_nvm_pgalloc_recs',
       inlined from 'bch_nvm_alloc_pages' at drivers/md/bcache/nvm-pages.c:364:19:
>> drivers/md/bcache/nvm-pages.c:138:3: warning: 'strncpy' output truncated before terminating nul copying 16 bytes from a string of the same length [-Wstringop-truncation]
     138 |   strncpy(recs->magic, bch_nvm_pages_pgalloc_magic, 16);
         |   ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

Kconfig warnings: (for reference only)
   WARNING: unmet direct dependencies detected for FRAME_POINTER
   Depends on DEBUG_KERNEL && (M68K || UML || SUPERH) || ARCH_WANT_FRAME_POINTERS
   Selected by
   - FAULT_INJECTION_STACKTRACE_FILTER && FAULT_INJECTION_DEBUG_FS && STACKTRACE_SUPPORT && !X86_64 && !MIPS && !PPC && !S390 && !MICROBLAZE && !ARM && !ARC && !X86


vim +/strncpy +138 drivers/md/bcache/nvm-pages.c

87ac110b7d6f58 Jianpeng Ma 2021-03-17  111  
87ac110b7d6f58 Jianpeng Ma 2021-03-17  112  static struct bch_nvm_pgalloc_recs *find_nvm_pgalloc_recs(struct bch_nvm_namespace *ns,
87ac110b7d6f58 Jianpeng Ma 2021-03-17  113  		struct bch_nvm_pages_owner_head *owner_head, bool create)
87ac110b7d6f58 Jianpeng Ma 2021-03-17  114  {
87ac110b7d6f58 Jianpeng Ma 2021-03-17  115  	int ns_nr = ns->sb->this_namespace_nr;
87ac110b7d6f58 Jianpeng Ma 2021-03-17  116  	struct bch_nvm_pgalloc_recs *prev_recs = NULL, *recs = owner_head->recs[ns_nr];
87ac110b7d6f58 Jianpeng Ma 2021-03-17  117  
87ac110b7d6f58 Jianpeng Ma 2021-03-17  118  	// If create=false, we return recs[nr]
87ac110b7d6f58 Jianpeng Ma 2021-03-17  119  	if (!create)
87ac110b7d6f58 Jianpeng Ma 2021-03-17  120  		return recs;
87ac110b7d6f58 Jianpeng Ma 2021-03-17  121  
87ac110b7d6f58 Jianpeng Ma 2021-03-17  122  	// If create=true, it mean we need a empty struct bch_pgalloc_rec
87ac110b7d6f58 Jianpeng Ma 2021-03-17  123  	// So we should find non-empty struct bch_nvm_pgalloc_recs or alloc
87ac110b7d6f58 Jianpeng Ma 2021-03-17  124  	// new struct bch_nvm_pgalloc_recs. And return this bch_nvm_pgalloc_recs
87ac110b7d6f58 Jianpeng Ma 2021-03-17  125  	while (recs && (recs->used == recs->size)) {
87ac110b7d6f58 Jianpeng Ma 2021-03-17  126  		prev_recs = recs;
87ac110b7d6f58 Jianpeng Ma 2021-03-17  127  		recs = recs->next;
87ac110b7d6f58 Jianpeng Ma 2021-03-17  128  	}
87ac110b7d6f58 Jianpeng Ma 2021-03-17  129  
87ac110b7d6f58 Jianpeng Ma 2021-03-17  130  	// Found empty struct bch_nvm_pgalloc_recs
87ac110b7d6f58 Jianpeng Ma 2021-03-17  131  	if (recs)
87ac110b7d6f58 Jianpeng Ma 2021-03-17  132  		return recs;
87ac110b7d6f58 Jianpeng Ma 2021-03-17  133  	// Need alloc new struct bch_nvm_galloc_recs
87ac110b7d6f58 Jianpeng Ma 2021-03-17  134  	recs = find_empty_pgalloc_recs();
87ac110b7d6f58 Jianpeng Ma 2021-03-17  135  	if (recs) {
87ac110b7d6f58 Jianpeng Ma 2021-03-17  136  		recs->next = NULL;
87ac110b7d6f58 Jianpeng Ma 2021-03-17  137  		recs->owner = owner_head;
87ac110b7d6f58 Jianpeng Ma 2021-03-17 @138  		strncpy(recs->magic, bch_nvm_pages_pgalloc_magic, 16);
87ac110b7d6f58 Jianpeng Ma 2021-03-17  139  		strncpy(recs->owner_uuid, owner_head->uuid, 16);
87ac110b7d6f58 Jianpeng Ma 2021-03-17  140  		recs->size = BCH_MAX_RECS;
87ac110b7d6f58 Jianpeng Ma 2021-03-17  141  		recs->used = 0;
87ac110b7d6f58 Jianpeng Ma 2021-03-17  142  
87ac110b7d6f58 Jianpeng Ma 2021-03-17  143  		if (prev_recs)
87ac110b7d6f58 Jianpeng Ma 2021-03-17  144  			prev_recs->next = recs;
87ac110b7d6f58 Jianpeng Ma 2021-03-17  145  		else
87ac110b7d6f58 Jianpeng Ma 2021-03-17  146  			owner_head->recs[ns_nr] = recs;
87ac110b7d6f58 Jianpeng Ma 2021-03-17  147  	}
87ac110b7d6f58 Jianpeng Ma 2021-03-17  148  
87ac110b7d6f58 Jianpeng Ma 2021-03-17  149  	return recs;
87ac110b7d6f58 Jianpeng Ma 2021-03-17  150  }
87ac110b7d6f58 Jianpeng Ma 2021-03-17  151  

:::::: The code at line 138 was first introduced by commit
:::::: 87ac110b7d6f58c8e115e988253f132c995a8f50 bcache: bch_nvm_alloc_pages() of the buddy

:::::: TO: Jianpeng Ma <jianpeng.ma@intel.com>
:::::: CC: Coly Li <colyli@suse.de>

---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all(a)lists.01.org

[-- Attachment #2: config.gz --]
[-- Type: application/gzip, Size: 63945 bytes --]

                 reply	other threads:[~2021-03-29 19:32 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=202103300345.bEkGAUIW-lkp@intel.com \
    --to=lkp@intel.com \
    --cc=kbuild-all@lists.01.org \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.