Linux-mm Archive mirror
 help / color / mirror / Atom feed
From: kernel test robot <lkp@intel.com>
To: Lijo Lazar <lijo.lazar@amd.com>
Cc: oe-kbuild-all@lists.linux.dev,
	Linux Memory Management List <linux-mm@kvack.org>,
	Alex Deucher <alexander.deucher@amd.com>,
	Asad Kamal <asad.kamal@amd.com>
Subject: [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
Date: Fri, 3 May 2024 21:28:51 +0800	[thread overview]
Message-ID: <202405032143.9iYuUxkm-lkp@intel.com> (raw)

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


                 reply	other threads:[~2024-05-03 13:29 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=202405032143.9iYuUxkm-lkp@intel.com \
    --to=lkp@intel.com \
    --cc=alexander.deucher@amd.com \
    --cc=asad.kamal@amd.com \
    --cc=lijo.lazar@amd.com \
    --cc=linux-mm@kvack.org \
    --cc=oe-kbuild-all@lists.linux.dev \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).