[bug report] drm/amdgpu: add amdgpu_ras.c to support ras (v2)

Dan Carpenter dan.carpenter at oracle.com
Wed Mar 20 13:23:32 UTC 2019


Hello xinhui pan,

This is a semi-automatic email about new static checker warnings.

The patch dbd249c24427: "drm/amdgpu: add amdgpu_ras.c to support ras 
(v2)" from Oct 31, 2018, leads to the following Smatch complaint:

    drivers/gpu/drm/amd/amdgpu/amdgpu_ras.c:1215 amdgpu_ras_add_bad_pages()
    warn: variable dereferenced before check 'con' (see line 1211)

    drivers/gpu/drm/amd/amdgpu/amdgpu_ras.c:1247 amdgpu_ras_reserve_bad_pages()
    warn: variable dereferenced before check 'con' (see line 1242)


drivers/gpu/drm/amd/amdgpu/amdgpu_ras.c
  1210		struct amdgpu_ras *con = amdgpu_ras_get_context(adev);
  1211		struct ras_err_handler_data *data = con->eh_data;
                                                    ^^^^^^^^^^^^
Dereference

  1212		int i = pages;
  1213		int ret = 0;
  1214	
  1215		if (!con || !data || !bps || pages <= 0)
                    ^^^^
Check

  1216			return 0;
  1217	

regards,
dan carpenter


More information about the amd-gfx mailing list