drivers/crypto/hisilicon/qm.c:1579:2: warning: 'strncpy' specified bound 64 equals destination size

From: kernel test robot
Date: Wed Jun 03 2020 - 09:55:29 EST


tree: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git master
head: d6f9469a03d832dcd17041ed67774ffb5f3e73b3
commit: 9e00df7156e45e42c695ffc596b4bf1328d00516 crypto: hisilicon - register zip engine to uacce
date: 3 months ago
config: ia64-randconfig-r026-20200603 (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
git checkout 9e00df7156e45e42c695ffc596b4bf1328d00516
# 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@xxxxxxxxx>

All warnings (new ones prefixed by >>, old ones prefixed by <<):

In function 'qm_alloc_uacce',
inlined from 'hisi_qm_init' at drivers/crypto/hisilicon/qm.c:1660:8:
>> drivers/crypto/hisilicon/qm.c:1579:2: warning: 'strncpy' specified bound 64 equals destination size [-Wstringop-truncation]
1579 | strncpy(interface.name, pdev->driver->name, sizeof(interface.name));
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

vim +/strncpy +1579 drivers/crypto/hisilicon/qm.c

1567
1568 static int qm_alloc_uacce(struct hisi_qm *qm)
1569 {
1570 struct pci_dev *pdev = qm->pdev;
1571 struct uacce_device *uacce;
1572 unsigned long mmio_page_nr;
1573 unsigned long dus_page_nr;
1574 struct uacce_interface interface = {
1575 .flags = UACCE_DEV_SVA,
1576 .ops = &uacce_qm_ops,
1577 };
1578
> 1579 strncpy(interface.name, pdev->driver->name, sizeof(interface.name));
1580
1581 uacce = uacce_alloc(&pdev->dev, &interface);
1582 if (IS_ERR(uacce))
1583 return PTR_ERR(uacce);
1584
1585 if (uacce->flags & UACCE_DEV_SVA) {
1586 qm->use_sva = true;
1587 } else {
1588 /* only consider sva case */
1589 uacce_remove(uacce);
1590 qm->uacce = NULL;
1591 return -EINVAL;
1592 }
1593
1594 uacce->is_vf = pdev->is_virtfn;
1595 uacce->priv = qm;
1596 uacce->algs = qm->algs;
1597
1598 if (qm->ver == QM_HW_V1) {
1599 mmio_page_nr = QM_DOORBELL_PAGE_NR;
1600 uacce->api_ver = HISI_QM_API_VER_BASE;
1601 } else {
1602 mmio_page_nr = QM_DOORBELL_PAGE_NR +
1603 QM_DOORBELL_SQ_CQ_BASE_V2 / PAGE_SIZE;
1604 uacce->api_ver = HISI_QM_API_VER2_BASE;
1605 }
1606
1607 dus_page_nr = (PAGE_SIZE - 1 + qm->sqe_size * QM_Q_DEPTH +
1608 sizeof(struct qm_cqe) * QM_Q_DEPTH) >> PAGE_SHIFT;
1609
1610 uacce->qf_pg_num[UACCE_QFRT_MMIO] = mmio_page_nr;
1611 uacce->qf_pg_num[UACCE_QFRT_DUS] = dus_page_nr;
1612
1613 qm->uacce = uacce;
1614
1615 return 0;
1616 }
1617

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

Attachment: .config.gz
Description: application/gzip