On Tue, Dec 15, 2020 at 11:09 PM kernel test robot <lkp(a)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/commi...
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(a)intel.com>
Hi robot,
The fix has been posted last week:
https://lore.kernel.org/linux-block/20201210101826.29656-2-jinpu.wang@clo...
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