[bug report] drm/amdgpu: switch ih handling to two levels (v3)

Dan Carpenter dan.carpenter at oracle.com
Tue Apr 4 13:04:13 UTC 2017


Hello Alex Deucher,

The patch d766e6a39338: "drm/amdgpu: switch ih handling to two levels
(v3)" from Mar 29, 2016, leads to the following static checker
warning:

	drivers/gpu/drm/amd/amdgpu/amdgpu_irq.c:319 amdgpu_irq_add_id()
	warn: double check that we're allocating correct size: 8 vs 32

drivers/gpu/drm/amd/amdgpu/amdgpu_irq.c
   305  int amdgpu_irq_add_id(struct amdgpu_device *adev,
   306                        unsigned client_id, unsigned src_id,
   307                        struct amdgpu_irq_src *source)
   308  {
   309          if (client_id >= AMDGPU_IH_CLIENTID_MAX)
   310                  return -EINVAL;
   311  
   312          if (src_id >= AMDGPU_MAX_IRQ_SRC_ID)
   313                  return -EINVAL;
   314  
   315          if (!source->funcs)
   316                  return -EINVAL;
   317  
   318          if (!adev->irq.client[client_id].sources) {
   319                  adev->irq.client[client_id].sources = kcalloc(AMDGPU_MAX_IRQ_SRC_ID,
   320                                                                sizeof(struct amdgpu_irq_src),
                                                                      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
We want to allocate an array of pointers, so probably this could be
changed to sizeof(void *)?

   321                                                                GFP_KERNEL);
   322                  if (!adev->irq.client[client_id].sources)
   323                          return -ENOMEM;
   324          }


regards,
dan carpenter


More information about the amd-gfx mailing list