All of lore.kernel.org
 help / color / mirror / Atom feed
* [intel-linux-intel-lts:5.4/yocto 413/1142] drivers/pci/controller/dwc/pcie-keembay.c:799:2: warning: 'strncpy' output truncated before terminating nul copying 2 bytes from a string of the same length
@ 2021-06-10 12:29 kernel test robot
  0 siblings, 0 replies; only message in thread
From: kernel test robot @ 2021-06-10 12:29 UTC (permalink / raw)
  To: kbuild-all

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

tree:   https://github.com/intel/linux-intel-lts.git 5.4/yocto
head:   eeb611e5394c56d45c5cc8f7dc484c9f19e93143
commit: 4d568c88671a6778939cb0d961566f95e6ce18ad [413/1142] PCI: keembay: Changes to support VPU PCIe driver
config: riscv-allyesconfig (attached as .config)
compiler: riscv64-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
        # https://github.com/intel/linux-intel-lts/commit/4d568c88671a6778939cb0d961566f95e6ce18ad
        git remote add intel-linux-intel-lts https://github.com/intel/linux-intel-lts.git
        git fetch --no-tags intel-linux-intel-lts 5.4/yocto
        git checkout 4d568c88671a6778939cb0d961566f95e6ce18ad
        # save the attached .config to linux build tree
        COMPILER_INSTALL_PATH=$HOME/0day COMPILER=gcc-9.3.0 make.cross ARCH=riscv 

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/pci/controller/dwc/pcie-keembay.c: In function 'keembay_pcie_probe':
>> drivers/pci/controller/dwc/pcie-keembay.c:799:2: warning: 'strncpy' output truncated before terminating nul copying 2 bytes from a string of the same length [-Wstringop-truncation]
     799 |  strncpy(pcie->stepping, "B0", strlen("B0"));
         |  ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~


vim +/strncpy +799 drivers/pci/controller/dwc/pcie-keembay.c

   749	
   750	static int keembay_pcie_probe(struct platform_device *pdev)
   751	{
   752		const struct keembay_pcie_of_data *data;
   753		const struct of_device_id *match;
   754		struct device *dev = &pdev->dev;
   755		struct keembay_pcie *pcie;
   756		struct dw_pcie *pci;
   757		struct resource *res;
   758		struct device_node *soc_node, *version_node;
   759		enum dw_pcie_device_mode mode;
   760		const char *prop;
   761		int prop_size;
   762		int ret;
   763	
   764		match = of_match_device(keembay_pcie_of_match, dev);
   765		if (!match)
   766			return -EINVAL;
   767	
   768		data = (struct keembay_pcie_of_data *)match->data;
   769		mode = (enum dw_pcie_device_mode)data->mode;
   770	
   771		pcie = devm_kzalloc(dev, sizeof(*pcie), GFP_KERNEL);
   772		if (!pcie)
   773			return -ENOMEM;
   774	
   775		pci = devm_kzalloc(dev, sizeof(*pci), GFP_KERNEL);
   776		if (!pci)
   777			return -ENOMEM;
   778	
   779		pci->dev = dev;
   780		pci->ops = &keembay_pcie_ops;
   781	
   782		pcie->pci = pci;
   783		pcie->mode = mode;
   784	
   785		res = platform_get_resource_byname(pdev, IORESOURCE_MEM, "apb");
   786		pcie->apb_base = devm_ioremap_resource(dev, res);
   787		if (IS_ERR(pcie->apb_base))
   788			return PTR_ERR(pcie->apb_base);
   789	
   790		res = platform_get_resource_byname(pdev, IORESOURCE_MEM, "dbi");
   791		pci->dbi_base = devm_ioremap_resource(dev, res);
   792		if (IS_ERR(pci->dbi_base))
   793			return PTR_ERR(pci->dbi_base);
   794	
   795		/* DBI2 shadow register */
   796		pci->dbi_base2 = pci->dbi_base + PCIE_DBI2_MASK;
   797	
   798		/* Keem Bay stepping info, based on DT */
 > 799		strncpy(pcie->stepping, "B0", strlen("B0"));
   800		soc_node = of_get_parent(pdev->dev.of_node);
   801		if (soc_node) {
   802			version_node = of_get_child_by_name(soc_node, "version-info");
   803			if (version_node) {
   804				prop = of_get_property(version_node, "stepping",
   805						       &prop_size);
   806				if (prop && prop_size <= KEEMBAY_PCIE_STEPPING_MAXLEN)
   807					strncpy(pcie->stepping, prop, prop_size);
   808				of_node_put(version_node);
   809			}
   810			of_node_put(soc_node);
   811		}
   812	
   813		platform_set_drvdata(pdev, pcie);
   814	
   815		switch (pcie->mode) {
   816		case DW_PCIE_RC_TYPE:
   817			if (!IS_ENABLED(CONFIG_PCIE_KEEMBAY_HOST))
   818				return -ENODEV;
   819	
   820			ret = keembay_pcie_add_pcie_port(pcie, pdev);
   821			if (ret < 0)
   822				return ret;
   823			break;
   824		case DW_PCIE_EP_TYPE:
   825			if (!IS_ENABLED(CONFIG_PCIE_KEEMBAY_EP))
   826				return -ENODEV;
   827	
   828			ret = keembay_pcie_add_pcie_ep(pcie, pdev);
   829			if (ret < 0)
   830				return ret;
   831			break;
   832		default:
   833			dev_err(dev, "INVALID device type %d\n", pcie->mode);
   834		}
   835	
   836		return 0;
   837	}
   838	

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

[-- Attachment #2: config.gz --]
[-- Type: application/gzip, Size: 61371 bytes --]

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2021-06-10 12:29 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-06-10 12:29 [intel-linux-intel-lts:5.4/yocto 413/1142] drivers/pci/controller/dwc/pcie-keembay.c:799:2: warning: 'strncpy' output truncated before terminating nul copying 2 bytes from a string of the same length kernel test robot

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.