All of lore.kernel.org
 help / color / mirror / Atom feed
From: Dan Carpenter <dan.carpenter-QHcLZuEGTsvQT0dZR+AlfA@public.gmane.org>
To: Bhawanpreet.Lakha-5C7GfCeVMHo@public.gmane.org
Cc: amd-gfx-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW@public.gmane.org
Subject: [bug report] drm/amd/display: Build stream update and plane updates in dm
Date: Fri, 28 Sep 2018 11:32:58 +0300	[thread overview]
Message-ID: <20180928083258.GA32031@mwanda> (raw)

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

             reply	other threads:[~2018-09-28  8:32 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-09-28  8:32 Dan Carpenter [this message]
2018-09-28 14:36 ` [bug report] drm/amd/display: Build stream update and plane updates in dm Bhawanpreet Lakha

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20180928083258.GA32031@mwanda \
    --to=dan.carpenter-qhclzuegtsvqt0dzr+alfa@public.gmane.org \
    --cc=Bhawanpreet.Lakha-5C7GfCeVMHo@public.gmane.org \
    --cc=amd-gfx-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW@public.gmane.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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.