Hello Rex Zhu,

The patch 1e256e276221: "drm/amdgpu: Refine CSA related functions"
from Oct 15, 2018, leads to the following static checker warning:

        drivers/gpu/drm/amd/amdgpu/amdgpu_csa.c:49 amdgpu_allocate_static_csa()
        error: uninitialized symbol 'ptr'.

drivers/gpu/drm/amd/amdgpu/amdgpu_csa.c
    37  int amdgpu_allocate_static_csa(struct amdgpu_device *adev, struct 
amdgpu_bo **bo,
    38                                  u32 domain, uint32_t size)
    39  {
    40          int r;
    41          void *ptr;
    42  
    43          r = amdgpu_bo_create_kernel(adev, size, PAGE_SIZE,
    44                                  domain, bo,
    45                                  NULL, &ptr);
    46          if (!bo)
                    ^^^
We've already dereferenced "bo" at this point so this test doesn't work.
Smatch doesn't complain because it knows that all the caller pass a
valid "bo" pointer...  Anyway probably this should just check if "r" is
non-zero.

    47                  return -ENOMEM;
    48  
    49          memset(ptr, 0, size);
                       ^^^
This is uninitialized if amdgpu_bo_create_kernel() fails.

    50          return 0;
    51  }

regards,
dan carpenter
_______________________________________________
amd-gfx mailing list
amd-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/amd-gfx

Reply via email to