The NULL comment is referring to the path to line 3388 via line 3360.  But
if the value is not NULL, there will be an update of previously freed
memory.

julia

---------- Forwarded message ----------
Date: Tue, 15 Aug 2017 18:58:51 +0800
From: kbuild test robot <fengguang...@intel.com>
To: kbu...@01.org
Cc: Julia Lawall <julia.law...@lip6.fr>
Subject: [radeon-alex:amd-staging-drm-next 773/843]
    drivers/gpu/drm/amd/amdgpu/../display/amdgpu_dm/amdgpu_dm.c:3388:8-15:
    ERROR: acrtc is NULL but dereferenced.

CC: kbuild-...@01.org
CC: dri-devel@lists.freedesktop.org
TO: Harry Wentland <harry.wentl...@amd.com>
CC: Alex Deucher <alexander.deuc...@amd.com>
CC: Tony Cheng <tony.ch...@amd.com>

tree:   git://people.freedesktop.org/~agd5f/linux.git amd-staging-drm-next
head:   aec1199c9095951449e3932fac49ddeb9e99884a
commit: 6d597da6c6c4b58a79887039db8fe5b221ccef3f [773/843] drm/amd/display: Fix 
ckeckpatch problems in amdgpu_dm
:::::: branch date: 12 hours ago
:::::: commit date: 14 hours ago

>> drivers/gpu/drm/amd/amdgpu/../display/amdgpu_dm/amdgpu_dm.c:3388:8-15: 
>> ERROR: acrtc is NULL but dereferenced.

git remote add radeon-alex git://people.freedesktop.org/~agd5f/linux.git
git remote update radeon-alex
git checkout 6d597da6c6c4b58a79887039db8fe5b221ccef3f
vim +3388 drivers/gpu/drm/amd/amdgpu/../display/amdgpu_dm/amdgpu_dm.c

83b1852f6 Harry Wentland 2017-08-10  3341
83b1852f6 Harry Wentland 2017-08-10  3342  int amdgpu_dm_crtc_init(struct 
amdgpu_display_manager *dm,
83b1852f6 Harry Wentland 2017-08-10  3343                       struct 
drm_plane *plane,
83b1852f6 Harry Wentland 2017-08-10  3344                       uint32_t 
crtc_index)
83b1852f6 Harry Wentland 2017-08-10  3345  {
83b1852f6 Harry Wentland 2017-08-10  3346       struct amdgpu_crtc *acrtc = 
NULL;
83b1852f6 Harry Wentland 2017-08-10  3347       struct amdgpu_plane 
*cursor_plane;
83b1852f6 Harry Wentland 2017-08-10  3348
83b1852f6 Harry Wentland 2017-08-10  3349       int res = -ENOMEM;
83b1852f6 Harry Wentland 2017-08-10  3350
83b1852f6 Harry Wentland 2017-08-10  3351       cursor_plane = 
kzalloc(sizeof(*cursor_plane), GFP_KERNEL);
83b1852f6 Harry Wentland 2017-08-10  3352       if (!cursor_plane)
83b1852f6 Harry Wentland 2017-08-10  3353               goto fail;
83b1852f6 Harry Wentland 2017-08-10  3354
83b1852f6 Harry Wentland 2017-08-10  3355       cursor_plane->base.type = 
DRM_PLANE_TYPE_CURSOR;
83b1852f6 Harry Wentland 2017-08-10  3356       res = amdgpu_dm_plane_init(dm, 
cursor_plane, 0);
83b1852f6 Harry Wentland 2017-08-10  3357
83b1852f6 Harry Wentland 2017-08-10  3358       acrtc = kzalloc(sizeof(struct 
amdgpu_crtc), GFP_KERNEL);
83b1852f6 Harry Wentland 2017-08-10  3359       if (!acrtc)
83b1852f6 Harry Wentland 2017-08-10  3360               goto fail;
83b1852f6 Harry Wentland 2017-08-10  3361
83b1852f6 Harry Wentland 2017-08-10  3362       res = drm_crtc_init_with_planes(
83b1852f6 Harry Wentland 2017-08-10  3363                       dm->ddev,
83b1852f6 Harry Wentland 2017-08-10  3364                       &acrtc->base,
83b1852f6 Harry Wentland 2017-08-10  3365                       plane,
83b1852f6 Harry Wentland 2017-08-10  3366                       
&cursor_plane->base,
83b1852f6 Harry Wentland 2017-08-10  3367                       
&amdgpu_dm_crtc_funcs, NULL);
83b1852f6 Harry Wentland 2017-08-10  3368
83b1852f6 Harry Wentland 2017-08-10  3369       if (res)
83b1852f6 Harry Wentland 2017-08-10  3370               goto fail;
83b1852f6 Harry Wentland 2017-08-10  3371
83b1852f6 Harry Wentland 2017-08-10  3372       
drm_crtc_helper_add(&acrtc->base, &amdgpu_dm_crtc_helper_funcs);
83b1852f6 Harry Wentland 2017-08-10  3373
83b1852f6 Harry Wentland 2017-08-10  3374       acrtc->max_cursor_width = 
dm->adev->dm.dc->caps.max_cursor_size;
83b1852f6 Harry Wentland 2017-08-10  3375       acrtc->max_cursor_height = 
dm->adev->dm.dc->caps.max_cursor_size;
83b1852f6 Harry Wentland 2017-08-10  3376
83b1852f6 Harry Wentland 2017-08-10  3377       acrtc->crtc_id = crtc_index;
83b1852f6 Harry Wentland 2017-08-10  3378       acrtc->base.enabled = false;
83b1852f6 Harry Wentland 2017-08-10  3379
83b1852f6 Harry Wentland 2017-08-10  3380       
dm->adev->mode_info.crtcs[crtc_index] = acrtc;
83b1852f6 Harry Wentland 2017-08-10  3381       
drm_mode_crtc_set_gamma_size(&acrtc->base, 256);
83b1852f6 Harry Wentland 2017-08-10  3382
83b1852f6 Harry Wentland 2017-08-10  3383       return 0;
83b1852f6 Harry Wentland 2017-08-10  3384
83b1852f6 Harry Wentland 2017-08-10  3385  fail:
83b1852f6 Harry Wentland 2017-08-10  3386       kfree(acrtc);
83b1852f6 Harry Wentland 2017-08-10  3387       kfree(cursor_plane);
83b1852f6 Harry Wentland 2017-08-10 @3388       acrtc->crtc_id = -1;
83b1852f6 Harry Wentland 2017-08-10  3389       return res;
83b1852f6 Harry Wentland 2017-08-10  3390  }
83b1852f6 Harry Wentland 2017-08-10  3391

:::::: The code at line 3388 was first introduced by commit
:::::: 83b1852f69c8d142d274f932b5a72bac2bf50953 drm/amd/display: Merge 
amdgpu_dm_types and amdgpu_dm

:::::: TO: Harry Wentland <harry.wentl...@amd.com>
:::::: CC: Alex Deucher <alexander.deuc...@amd.com>

---
0-DAY kernel test infrastructure                Open Source Technology Center
https://lists.01.org/pipermail/kbuild-all                   Intel Corporation
_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel

Reply via email to