* [bug report] drm/amd/display: Build stream update and plane updates in dm
@ 2018-09-28 8:32 Dan Carpenter
2018-09-28 14:36 ` Bhawanpreet Lakha
0 siblings, 1 reply; 2+ messages in thread
From: Dan Carpenter @ 2018-09-28 8:32 UTC (permalink / raw)
To: Bhawanpreet.Lakha-5C7GfCeVMHo; +Cc: amd-gfx-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW
Hello Bhawanpreet Lakha,
The patch a87fa9938749: "drm/amd/display: Build stream update and
plane updates in dm" from Aug 20, 2018, leads to the following static
checker warning:
drivers/gpu/drm/amd/amdgpu/../display/amdgpu_dm/amdgpu_dm.c:5190 dm_determine_update_type_for_commit()
error: potential null dereference 'surface'. (kzalloc returns null)
drivers/gpu/drm/amd/amdgpu/../display/amdgpu_dm/amdgpu_dm.c
5153 int i, j, num_plane;
5154 struct drm_plane_state *old_plane_state, *new_plane_state;
5155 struct dm_plane_state *new_dm_plane_state, *old_dm_plane_state;
5156 struct drm_crtc *new_plane_crtc, *old_plane_crtc;
5157 struct drm_plane *plane;
5158
5159 struct drm_crtc *crtc;
5160 struct drm_crtc_state *new_crtc_state, *old_crtc_state;
5161 struct dm_crtc_state *new_dm_crtc_state, *old_dm_crtc_state;
5162 struct dc_stream_status *status = NULL;
5163
5164 struct dc_surface_update *updates = kzalloc(MAX_SURFACES * sizeof(struct dc_surface_update), GFP_KERNEL);
^^^^^^^^^^^^^^^^^
5165 struct dc_plane_state *surface = kzalloc(MAX_SURFACES * sizeof(struct dc_plane_state), GFP_KERNEL);
^^^^^^^^^^^^^^^^^
No checks for NULL.
5166 struct dc_stream_update stream_update;
5167 enum surface_update_type update_type = UPDATE_TYPE_FAST;
5168
5169
5170 for_each_oldnew_crtc_in_state(state, crtc, old_crtc_state, new_crtc_state, i) {
5171 new_dm_crtc_state = to_dm_crtc_state(new_crtc_state);
5172 old_dm_crtc_state = to_dm_crtc_state(old_crtc_state);
5173 num_plane = 0;
5174
5175 if (new_dm_crtc_state->stream) {
5176
5177 for_each_oldnew_plane_in_state(state, plane, old_plane_state, new_plane_state, j) {
5178 new_plane_crtc = new_plane_state->crtc;
5179 old_plane_crtc = old_plane_state->crtc;
5180 new_dm_plane_state = to_dm_plane_state(new_plane_state);
5181 old_dm_plane_state = to_dm_plane_state(old_plane_state);
5182
5183 if (plane->type == DRM_PLANE_TYPE_CURSOR)
5184 continue;
5185
5186 if (!state->allow_modeset)
5187 continue;
5188
5189 if (crtc == new_plane_crtc) {
5190 updates[num_plane].surface = &surface[num_plane];
5191
5192 if (new_crtc_state->mode_changed) {
5193 updates[num_plane].surface->src_rect =
5194 new_dm_plane_state->dc_state->src_rect;
5195 updates[num_plane].surface->dst_rect =
5196 new_dm_plane_state->dc_state->dst_rect;
5197 updates[num_plane].surface->rotation =
regards,
dan carpenter
_______________________________________________
amd-gfx mailing list
amd-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/amd-gfx
^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: [bug report] drm/amd/display: Build stream update and plane updates in dm
2018-09-28 8:32 [bug report] drm/amd/display: Build stream update and plane updates in dm Dan Carpenter
@ 2018-09-28 14:36 ` Bhawanpreet Lakha
0 siblings, 0 replies; 2+ messages in thread
From: Bhawanpreet Lakha @ 2018-09-28 14:36 UTC (permalink / raw)
To: Dan Carpenter; +Cc: amd-gfx-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW
I had a patch ready and was going to send it in the next promotion
patches. Will send it soon.
Bhawan
On 2018-09-28 04:32 AM, Dan Carpenter wrote:
> Hello Bhawanpreet Lakha,
>
> The patch a87fa9938749: "drm/amd/display: Build stream update and
> plane updates in dm" from Aug 20, 2018, leads to the following static
> checker warning:
>
> drivers/gpu/drm/amd/amdgpu/../display/amdgpu_dm/amdgpu_dm.c:5190 dm_determine_update_type_for_commit()
> error: potential null dereference 'surface'. (kzalloc returns null)
>
> drivers/gpu/drm/amd/amdgpu/../display/amdgpu_dm/amdgpu_dm.c
> 5153 int i, j, num_plane;
> 5154 struct drm_plane_state *old_plane_state, *new_plane_state;
> 5155 struct dm_plane_state *new_dm_plane_state, *old_dm_plane_state;
> 5156 struct drm_crtc *new_plane_crtc, *old_plane_crtc;
> 5157 struct drm_plane *plane;
> 5158
> 5159 struct drm_crtc *crtc;
> 5160 struct drm_crtc_state *new_crtc_state, *old_crtc_state;
> 5161 struct dm_crtc_state *new_dm_crtc_state, *old_dm_crtc_state;
> 5162 struct dc_stream_status *status = NULL;
> 5163
> 5164 struct dc_surface_update *updates = kzalloc(MAX_SURFACES * sizeof(struct dc_surface_update), GFP_KERNEL);
> ^^^^^^^^^^^^^^^^^
> 5165 struct dc_plane_state *surface = kzalloc(MAX_SURFACES * sizeof(struct dc_plane_state), GFP_KERNEL);
> ^^^^^^^^^^^^^^^^^
> No checks for NULL.
>
> 5166 struct dc_stream_update stream_update;
> 5167 enum surface_update_type update_type = UPDATE_TYPE_FAST;
> 5168
> 5169
> 5170 for_each_oldnew_crtc_in_state(state, crtc, old_crtc_state, new_crtc_state, i) {
> 5171 new_dm_crtc_state = to_dm_crtc_state(new_crtc_state);
> 5172 old_dm_crtc_state = to_dm_crtc_state(old_crtc_state);
> 5173 num_plane = 0;
> 5174
> 5175 if (new_dm_crtc_state->stream) {
> 5176
> 5177 for_each_oldnew_plane_in_state(state, plane, old_plane_state, new_plane_state, j) {
> 5178 new_plane_crtc = new_plane_state->crtc;
> 5179 old_plane_crtc = old_plane_state->crtc;
> 5180 new_dm_plane_state = to_dm_plane_state(new_plane_state);
> 5181 old_dm_plane_state = to_dm_plane_state(old_plane_state);
> 5182
> 5183 if (plane->type == DRM_PLANE_TYPE_CURSOR)
> 5184 continue;
> 5185
> 5186 if (!state->allow_modeset)
> 5187 continue;
> 5188
> 5189 if (crtc == new_plane_crtc) {
> 5190 updates[num_plane].surface = &surface[num_plane];
> 5191
> 5192 if (new_crtc_state->mode_changed) {
> 5193 updates[num_plane].surface->src_rect =
> 5194 new_dm_plane_state->dc_state->src_rect;
> 5195 updates[num_plane].surface->dst_rect =
> 5196 new_dm_plane_state->dc_state->dst_rect;
> 5197 updates[num_plane].surface->rotation =
>
> regards,
> dan carpenter
_______________________________________________
amd-gfx mailing list
amd-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/amd-gfx
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2018-09-28 14:36 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2018-09-28 8:32 [bug report] drm/amd/display: Build stream update and plane updates in dm Dan Carpenter
2018-09-28 14:36 ` Bhawanpreet Lakha
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.