[linux-next:master 10507/10967] drivers/gpu/drm/amd/amdxcp/amdgpu_xcp_drv.c:59:58: error: '%d' directive output may be truncated writing between 1 and 11 bytes into a region of size 9

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



tree:   https://git.kernel.org/pub/scm/linux/kernel/git/next/linux-next.git master
head:   9221b2819b8a4196eecf5476d66201be60fbcf29
commit: 97d814fe4f697791abfbe27e035f0b943c483243 [10507/10967] drm/amd/amdxcp: Use unique name for partition dev
config: s390-allyesconfig (https://download.01.org/0day-ci/archive/20240503/202405031953.taqZevDO-lkp@xxxxxxxxx/config)
compiler: s390-linux-gcc (GCC) 13.2.0
reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20240503/202405031953.taqZevDO-lkp@xxxxxxxxx/reproduce)

If you fix the issue in a separate patch/commit (i.e. not just a new version of
the same patch/commit), kindly add following tags
| Reported-by: kernel test robot <lkp@xxxxxxxxx>
| Closes: https://lore.kernel.org/oe-kbuild-all/202405031953.taqZevDO-lkp@xxxxxxxxx/

All errors (new ones prefixed by >>):

   drivers/gpu/drm/amd/amdxcp/amdgpu_xcp_drv.c: In function 'amdgpu_xcp_drm_dev_alloc':
>> drivers/gpu/drm/amd/amdxcp/amdgpu_xcp_drv.c:59:58: error: '%d' directive output may be truncated writing between 1 and 11 bytes into a region of size 9 [-Werror=format-truncation=]
      59 |         snprintf(dev_name, sizeof(dev_name), "amdgpu_xcp_%d", pdev_num);
         |                                                          ^~
   drivers/gpu/drm/amd/amdxcp/amdgpu_xcp_drv.c:59:46: note: directive argument in the range [-2147483648, 63]
      59 |         snprintf(dev_name, sizeof(dev_name), "amdgpu_xcp_%d", pdev_num);
         |                                              ^~~~~~~~~~~~~~~
   drivers/gpu/drm/amd/amdxcp/amdgpu_xcp_drv.c:59:9: note: 'snprintf' output between 13 and 23 bytes into a destination of size 20
      59 |         snprintf(dev_name, sizeof(dev_name), "amdgpu_xcp_%d", pdev_num);
         |         ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   cc1: all warnings being treated as errors


vim +59 drivers/gpu/drm/amd/amdxcp/amdgpu_xcp_drv.c

    48	
    49	int amdgpu_xcp_drm_dev_alloc(struct drm_device **ddev)
    50	{
    51		struct platform_device *pdev;
    52		struct xcp_device *pxcp_dev;
    53		char dev_name[20];
    54		int ret;
    55	
    56		if (pdev_num >= MAX_XCP_PLATFORM_DEVICE)
    57			return -ENODEV;
    58	
  > 59		snprintf(dev_name, sizeof(dev_name), "amdgpu_xcp_%d", pdev_num);
    60		pdev = platform_device_register_simple(dev_name, -1, NULL, 0);
    61		if (IS_ERR(pdev))
    62			return PTR_ERR(pdev);
    63	
    64		if (!devres_open_group(&pdev->dev, NULL, GFP_KERNEL)) {
    65			ret = -ENOMEM;
    66			goto out_unregister;
    67		}
    68	
    69		pxcp_dev = devm_drm_dev_alloc(&pdev->dev, &amdgpu_xcp_driver, struct xcp_device, drm);
    70		if (IS_ERR(pxcp_dev)) {
    71			ret = PTR_ERR(pxcp_dev);
    72			goto out_devres;
    73		}
    74	
    75		xcp_dev[pdev_num] = pxcp_dev;
    76		xcp_dev[pdev_num]->pdev = pdev;
    77		*ddev = &pxcp_dev->drm;
    78		pdev_num++;
    79	
    80		return 0;
    81	
    82	out_devres:
    83		devres_release_group(&pdev->dev, NULL);
    84	out_unregister:
    85		platform_device_unregister(pdev);
    86	
    87		return ret;
    88	}
    89	EXPORT_SYMBOL(amdgpu_xcp_drm_dev_alloc);
    90	

-- 
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests/wiki




[Index of Archives]     [Linux ARM Kernel]     [Linux ARM]     [Linux Omap]     [Fedora ARM]     [IETF Annouce]     [Bugtraq]     [Linux OMAP]     [Linux MIPS]     [eCos]     [Asterisk Internet PBX]     [Linux API]

  Powered by Linux