[xilinx-xlnx:xlnx_rebase_v5.15_LTS 1119/1160] drivers/gpu/drm/xlnx/xlnx_pl_disp.c:612:9: warning: 'strncpy' specified bound 4 equals destination size

kernel test robot lkp at intel.com
Fri Jun 10 18:16:10 PDT 2022


Hi Venkateshwar,

FYI, the error/warning still remains.

tree:   https://github.com/Xilinx/linux-xlnx xlnx_rebase_v5.15_LTS
head:   21e0373d8477c67f5e78448385cda0548d5fdc18
commit: ed3d6f39268f7e7e5f7f74435baeb353571851ae [1119/1160] drm: xlnx: pl_disp: Add strict check of video format in dt parsing.
config: alpha-allyesconfig (https://download.01.org/0day-ci/archive/20220611/202206110908.pS6Q4Oht-lkp@intel.com/config)
compiler: alpha-linux-gcc (GCC) 11.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/Xilinx/linux-xlnx/commit/ed3d6f39268f7e7e5f7f74435baeb353571851ae
        git remote add xilinx-xlnx https://github.com/Xilinx/linux-xlnx
        git fetch --no-tags xilinx-xlnx xlnx_rebase_v5.15_LTS
        git checkout ed3d6f39268f7e7e5f7f74435baeb353571851ae
        # save the config file
        mkdir build_dir && cp config build_dir/.config
        COMPILER_INSTALL_PATH=$HOME/0day COMPILER=gcc-11.3.0 make.cross W=1 O=build_dir ARCH=alpha SHELL=/bin/bash drivers/gpu/drm/xlnx/

If you fix the issue, kindly add following tag where applicable
Reported-by: kernel test robot <lkp at intel.com>

All warnings (new ones prefixed by >>):

   drivers/gpu/drm/xlnx/xlnx_pl_disp.c: In function 'xlnx_pl_disp_probe':
>> drivers/gpu/drm/xlnx/xlnx_pl_disp.c:612:9: warning: 'strncpy' specified bound 4 equals destination size [-Wstringop-truncation]
     612 |         strncpy((char *)&xlnx_pl_disp->fmt, vformat, XLNX_PL_DISP_VFMT_SIZE);
         |         ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~


vim +/strncpy +612 drivers/gpu/drm/xlnx/xlnx_pl_disp.c

   578	
   579	static int xlnx_pl_disp_probe(struct platform_device *pdev)
   580	{
   581		struct device *dev = &pdev->dev;
   582		struct device_node *vtc_node;
   583		struct xlnx_pl_disp *xlnx_pl_disp;
   584		int ret;
   585		const char *vformat;
   586		struct dma_chan *dma_chan;
   587		struct xlnx_dma_chan *xlnx_dma_chan;
   588		const struct drm_format_info *info;
   589	
   590		xlnx_pl_disp = devm_kzalloc(dev, sizeof(*xlnx_pl_disp), GFP_KERNEL);
   591		if (!xlnx_pl_disp)
   592			return -ENOMEM;
   593	
   594		dma_chan = of_dma_request_slave_channel(dev->of_node, "dma0");
   595		if (IS_ERR_OR_NULL(dma_chan)) {
   596			dev_err(dev, "failed to request dma channel\n");
   597			return PTR_ERR(dma_chan);
   598		}
   599	
   600		xlnx_dma_chan = devm_kzalloc(dev, sizeof(*xlnx_dma_chan), GFP_KERNEL);
   601		if (!xlnx_dma_chan)
   602			return -ENOMEM;
   603	
   604		xlnx_dma_chan->dma_chan = dma_chan;
   605		xlnx_pl_disp->chan = xlnx_dma_chan;
   606		ret = of_property_read_string(dev->of_node, "xlnx,vformat", &vformat);
   607		if (ret) {
   608			dev_err(dev, "No xlnx,vformat value in dts\n");
   609			goto err_dma;
   610		}
   611	
 > 612		strncpy((char *)&xlnx_pl_disp->fmt, vformat, XLNX_PL_DISP_VFMT_SIZE);
   613		info = drm_format_info(xlnx_pl_disp->fmt);
   614		if (!info) {
   615			dev_err(dev, "Invalid video format in dts\n");
   616			ret = -EINVAL;
   617			goto err_dma;
   618		}
   619	
   620		/* VTC Bridge support */
   621		vtc_node = of_parse_phandle(dev->of_node, "xlnx,bridge", 0);
   622		if (vtc_node) {
   623			xlnx_pl_disp->vtc_bridge = of_xlnx_bridge_get(vtc_node);
   624			if (!xlnx_pl_disp->vtc_bridge) {
   625				dev_info(dev, "Didn't get vtc bridge instance\n");
   626				ret = -EPROBE_DEFER;
   627				goto err_dma;
   628			}
   629		} else {
   630			dev_info(dev, "vtc bridge property not present\n");
   631		}
   632	
   633		xlnx_pl_disp->dev = dev;
   634		platform_set_drvdata(pdev, xlnx_pl_disp);
   635	
   636		ret = component_add(dev, &xlnx_pl_disp_component_ops);
   637		if (ret)
   638			goto err_dma;
   639	
   640		xlnx_pl_disp->master = xlnx_drm_pipeline_init(pdev);
   641		if (IS_ERR(xlnx_pl_disp->master)) {
   642			ret = PTR_ERR(xlnx_pl_disp->master);
   643			dev_err(dev, "failed to initialize the drm pipeline\n");
   644			goto err_component;
   645		}
   646	
   647		dev_info(&pdev->dev, "Xlnx PL display driver probed\n");
   648	
   649		return 0;
   650	
   651	err_component:
   652		component_del(dev, &xlnx_pl_disp_component_ops);
   653	err_dma:
   654		dma_release_channel(xlnx_pl_disp->chan->dma_chan);
   655	
   656		return ret;
   657	}
   658	

-- 
0-DAY CI Kernel Test Service
https://01.org/lkp



More information about the linux-arm-kernel mailing list