Intel-GFX Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: "Ville Syrjälä" <ville.syrjala@linux.intel.com>
To: Dan Carpenter <dan.carpenter@oracle.com>
Cc: intel-gfx@lists.freedesktop.org
Subject: Re: [Intel-gfx] [bug report] drm/i915: Fix enabled_planes bitmask
Date: Wed, 24 Mar 2021 15:31:20 +0200	[thread overview]
Message-ID: <YFs/KA78gK3eGEu1@intel.com> (raw)
In-Reply-To: <YFrozlRheXy9ziyK@mwanda>

On Wed, Mar 24, 2021 at 10:22:54AM +0300, Dan Carpenter wrote:
> Hello Ville Syrjälä,
> 
> This is a semi-automatic email about new static checker warnings.
> 
> The patch 97bc7ffa1b1e: "drm/i915: Fix enabled_planes bitmask" from
> Mar 5, 2021, leads to the following Smatch complaint:
> 
>     drivers/gpu/drm/i915/display/intel_atomic_plane.c:332 intel_plane_atomic_check_with_state()
>     error: we previously assumed 'fb' could be null (see line 324)
> 
> drivers/gpu/drm/i915/display/intel_atomic_plane.c
>    323	
>    324		if (fb)
>                     ^^
> The patch adds a check for NULL
> 
>    325			new_crtc_state->enabled_planes |= BIT(plane->id);
>    326	
>    327		/* FIXME pre-g4x don't work like this */
>    328		if (new_plane_state->uapi.visible)
>    329			new_crtc_state->active_planes |= BIT(plane->id);
>    330	
>    331		if (new_plane_state->uapi.visible &&
>    332		    intel_format_info_is_yuv_semiplanar(fb->format, fb->modifier))
>                                                         ^^^^^^^^^^^^^^^^^^^^^^^^
> Unchecked deref
> 
>    333			new_crtc_state->nv12_planes |= BIT(plane->id);
>    334	
>    335          if (new_plane_state->uapi.visible &&
>    336              fb->format->format == DRM_FORMAT_C8)
>                     ^^^^^^^^^^
> Same.  These are potentially false positives.  I don't know if
> "uapi.visible" can be true when ctrc is non-NULL and fb is NULL for
> example?  (The point is I read the commit message, but I know pants all
> about DRM.  :P)

If there's no fb then uapi.visible=false. See
intel_atomic_plane_check_clipping().

> 
>    337                  new_crtc_state->c8_planes |= BIT(plane->id);
>    338  
>    339          if (new_plane_state->uapi.visible || old_plane_state->uapi.visible)
>    340                  new_crtc_state->update_planes |= BIT(plane->id);
>    341  
>    342          new_crtc_state->data_rate[plane->id] =
>    343                  intel_plane_data_rate(new_crtc_state, new_plane_state);
>    344  
>    345          return intel_plane_atomic_calc_changes(old_crtc_state, new_crtc_state,
>    346                                                 old_plane_state, new_plane_state);
>    347  }
> 
> regards,
> dan carpenter

-- 
Ville Syrjälä
Intel
_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

      reply	other threads:[~2021-03-24 13:31 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-03-24  7:22 [Intel-gfx] [bug report] drm/i915: Fix enabled_planes bitmask Dan Carpenter
2021-03-24 13:31 ` Ville Syrjälä [this message]

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=YFs/KA78gK3eGEu1@intel.com \
    --to=ville.syrjala@linux.intel.com \
    --cc=dan.carpenter@oracle.com \
    --cc=intel-gfx@lists.freedesktop.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox