linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
From: kernel test robot <lkp@intel.com>
To: Md Haris Iqbal <haris.iqbal@cloud.ionos.com>
Cc: kbuild-all@lists.01.org, clang-built-linux@googlegroups.com,
	Linux Memory Management List <linux-mm@kvack.org>,
	Jens Axboe <axboe@kernel.dk>,
	Jack Wang <jinpu.wang@cloud.ionos.com>,
	Lutz Pogrell <lutz.pogrell@cloud.ionos.com>
Subject: [linux-next:master 9830/13311] drivers/block/rnbd/rnbd-clt.c:1397:42: warning: size argument in 'strlcpy' call appears to be size of the source; expected the size of the destination
Date: Wed, 16 Dec 2020 06:08:16 +0800	[thread overview]
Message-ID: <202012160612.RJtcXy6U-lkp@intel.com> (raw)

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

Hi Md,

FYI, the error/warning still remains.

tree:   https://git.kernel.org/pub/scm/linux/kernel/git/next/linux-next.git master
head:   9317f948b0b188b8d2fded75957e6d42c460df1b
commit: 64e8a6ece1a5b1fa21316918053d068baeac84af [9830/13311] block/rnbd-clt: Dynamically alloc buffer for pathname & blk_symlink_name
config: x86_64-randconfig-a006-20201216 (attached as .config)
compiler: clang version 12.0.0 (https://github.com/llvm/llvm-project a29ecca7819a6ed4250d3689b12b1f664bb790d7)
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
        # install x86_64 cross compiling tool for clang build
        # apt-get install binutils-x86-64-linux-gnu
        # https://git.kernel.org/pub/scm/linux/kernel/git/next/linux-next.git/commit/?id=64e8a6ece1a5b1fa21316918053d068baeac84af
        git remote add linux-next https://git.kernel.org/pub/scm/linux/kernel/git/next/linux-next.git
        git fetch --no-tags linux-next master
        git checkout 64e8a6ece1a5b1fa21316918053d068baeac84af
        # save the attached .config to linux build tree
        COMPILER_INSTALL_PATH=$HOME/0day COMPILER=clang make.cross ARCH=x86_64 

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/block/rnbd/rnbd-clt.c:1397:42: warning: size argument in 'strlcpy' call appears to be size of the source; expected the size of the destination [-Wstrlcpy-strlcat-size]
           strlcpy(dev->pathname, pathname, strlen(pathname) + 1);
                                            ~~~~~~~^~~~~~~~~~~~~
   1 warning generated.

vim +/strlcpy +1397 drivers/block/rnbd/rnbd-clt.c

  1363	
  1364	static struct rnbd_clt_dev *init_dev(struct rnbd_clt_session *sess,
  1365					      enum rnbd_access_mode access_mode,
  1366					      const char *pathname)
  1367	{
  1368		struct rnbd_clt_dev *dev;
  1369		int ret;
  1370	
  1371		dev = kzalloc_node(sizeof(*dev), GFP_KERNEL, NUMA_NO_NODE);
  1372		if (!dev)
  1373			return ERR_PTR(-ENOMEM);
  1374	
  1375		dev->hw_queues = kcalloc(nr_cpu_ids, sizeof(*dev->hw_queues),
  1376					 GFP_KERNEL);
  1377		if (!dev->hw_queues) {
  1378			ret = -ENOMEM;
  1379			goto out_alloc;
  1380		}
  1381	
  1382		mutex_lock(&ida_lock);
  1383		ret = ida_simple_get(&index_ida, 0, 1 << (MINORBITS - RNBD_PART_BITS),
  1384				     GFP_KERNEL);
  1385		mutex_unlock(&ida_lock);
  1386		if (ret < 0) {
  1387			pr_err("Failed to initialize device '%s' from session %s, allocating idr failed, err: %d\n",
  1388			       pathname, sess->sessname, ret);
  1389			goto out_queues;
  1390		}
  1391	
  1392		dev->pathname = kzalloc(strlen(pathname) + 1, GFP_KERNEL);
  1393		if (!dev->pathname) {
  1394			ret = -ENOMEM;
  1395			goto out_queues;
  1396		}
> 1397		strlcpy(dev->pathname, pathname, strlen(pathname) + 1);
  1398	
  1399		dev->clt_device_id	= ret;
  1400		dev->sess		= sess;
  1401		dev->access_mode	= access_mode;
  1402		mutex_init(&dev->lock);
  1403		refcount_set(&dev->refcount, 1);
  1404		dev->dev_state = DEV_STATE_INIT;
  1405	
  1406		/*
  1407		 * Here we called from sysfs entry, thus clt-sysfs is
  1408		 * responsible that session will not disappear.
  1409		 */
  1410		WARN_ON(!rnbd_clt_get_sess(sess));
  1411	
  1412		return dev;
  1413	
  1414	out_queues:
  1415		kfree(dev->hw_queues);
  1416	out_alloc:
  1417		kfree(dev);
  1418		return ERR_PTR(ret);
  1419	}
  1420	

---
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: 34520 bytes --]

             reply	other threads:[~2020-12-15 22:09 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-12-15 22:08 kernel test robot [this message]
2020-12-16  6:29 ` [linux-next:master 9830/13311] drivers/block/rnbd/rnbd-clt.c:1397:42: warning: size argument in 'strlcpy' call appears to be size of the source; expected the size of the destination Jinpu Wang

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=202012160612.RJtcXy6U-lkp@intel.com \
    --to=lkp@intel.com \
    --cc=axboe@kernel.dk \
    --cc=clang-built-linux@googlegroups.com \
    --cc=haris.iqbal@cloud.ionos.com \
    --cc=jinpu.wang@cloud.ionos.com \
    --cc=kbuild-all@lists.01.org \
    --cc=linux-mm@kvack.org \
    --cc=lutz.pogrell@cloud.ionos.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;
as well as URLs for NNTP newsgroup(s).