linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
* [linux-next:master 10507/10967] drivers/gpu/drm/amd/amdxcp/amdgpu_xcp_drv.c:59:58: warning: '%d' directive output may be truncated writing between 1 and 11 bytes into a region of size 9
@ 2024-05-03 13:28 kernel test robot
  0 siblings, 0 replies; only message in thread
From: kernel test robot @ 2024-05-03 13:28 UTC (permalink / raw)
  To: Lijo Lazar
  Cc: oe-kbuild-all, Linux Memory Management List, Alex Deucher, Asad Kamal

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: csky-randconfig-r031-20220611 (https://download.01.org/0day-ci/archive/20240503/202405032143.9iYuUxkm-lkp@intel.com/config)
compiler: csky-linux-gcc (GCC) 13.2.0
reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20240503/202405032143.9iYuUxkm-lkp@intel.com/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@intel.com>
| Closes: https://lore.kernel.org/oe-kbuild-all/202405032143.9iYuUxkm-lkp@intel.com/

All warnings (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: warning: '%d' directive output may be truncated writing between 1 and 11 bytes into a region of size 9 [-Wformat-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);
         |         ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~


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


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

only message in thread, other threads:[~2024-05-03 13:29 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-05-03 13:28 [linux-next:master 10507/10967] drivers/gpu/drm/amd/amdxcp/amdgpu_xcp_drv.c:59:58: warning: '%d' directive output may be truncated writing between 1 and 11 bytes into a region of size 9 kernel test robot

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox