All of lore.kernel.org
 help / color / mirror / Atom feed
From: Haris Iqbal <haris.iqbal@cloud.ionos.com>
To: kbuild-all@lists.01.org
Subject: Re: [block:for-5.11/drivers 49/60] 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: Tue, 08 Dec 2020 12:46:32 +0530	[thread overview]
Message-ID: <CAJpMwyhnsNE0==NzPi=AbNtEgHaW5GGs3s+XvkXQxO_c4TRAsA@mail.gmail.com> (raw)
In-Reply-To: <202012081357.mUFLvYI9-lkp@intel.com>

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

Working on it.

On Tue, Dec 8, 2020 at 10:42 AM kernel test robot <lkp@intel.com> wrote:
>
> tree:   https://git.kernel.org/pub/scm/linux/kernel/git/axboe/linux-block.git for-5.11/drivers
> head:   eebf34a85c8c724676eba502d15202854f199b05
> commit: 64e8a6ece1a5b1fa21316918053d068baeac84af [49/60] block/rnbd-clt: Dynamically alloc buffer for pathname & blk_symlink_name
> config: arm-randconfig-r002-20201208 (attached as .config)
> compiler: clang version 12.0.0 (https://github.com/llvm/llvm-project a2f922140f5380571fb74179f2bf622b3b925697)
> 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 arm cross compiling tool for clang build
>         # apt-get install binutils-arm-linux-gnueabi
>         # https://git.kernel.org/pub/scm/linux/kernel/git/axboe/linux-block.git/commit/?id=64e8a6ece1a5b1fa21316918053d068baeac84af
>         git remote add block https://git.kernel.org/pub/scm/linux/kernel/git/axboe/linux-block.git
>         git fetch --no-tags block for-5.11/drivers
>         git checkout 64e8a6ece1a5b1fa21316918053d068baeac84af
>         # save the attached .config to linux build tree
>         COMPILER_INSTALL_PATH=$HOME/0day COMPILER=clang make.cross ARCH=arm
>
> 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(a)lists.01.org

      reply	other threads:[~2020-12-08  7:16 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-12-08  5:11 [block:for-5.11/drivers 49/60] 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 kernel test robot
2020-12-08  7:16 ` Haris Iqbal [this message]

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='CAJpMwyhnsNE0==NzPi=AbNtEgHaW5GGs3s+XvkXQxO_c4TRAsA@mail.gmail.com' \
    --to=haris.iqbal@cloud.ionos.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.