* [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
@ 2020-12-15 22:08 kernel test robot
2020-12-16 6:29 ` Jinpu Wang
0 siblings, 1 reply; 2+ messages in thread
From: kernel test robot @ 2020-12-15 22:08 UTC (permalink / raw)
To: Md Haris Iqbal
Cc: kbuild-all, clang-built-linux, Linux Memory Management List,
Jens Axboe, Jack Wang, Lutz Pogrell
[-- 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 --]
^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: [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
2020-12-15 22:08 [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 kernel test robot
@ 2020-12-16 6:29 ` Jinpu Wang
0 siblings, 0 replies; 2+ messages in thread
From: Jinpu Wang @ 2020-12-16 6:29 UTC (permalink / raw)
To: kernel test robot
Cc: Md Haris Iqbal, kbuild-all, clang-built-linux,
Linux Memory Management List, Jens Axboe, Lutz Pogrell
On Tue, Dec 15, 2020 at 11:09 PM kernel test robot <lkp@intel.com> wrote:
>
> 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>
Hi robot,
The fix has been posted last week:
https://lore.kernel.org/linux-block/20201210101826.29656-2-jinpu.wang@cloud.ionos.com/T/#u
Thanks!
>
> 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
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2020-12-16 6:29 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-12-15 22:08 [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 kernel test robot
2020-12-16 6:29 ` Jinpu Wang
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).