From: Jani Nikula <jani.nikula@linux.intel.com>
To: Lu Yao <yaolu@kylinos.cn>,
rodrigo.vivi@intel.com, joonas.lahtinen@linux.intel.com,
tursulin@ursulin.net
Cc: intel-gfx@lists.freedesktop.org, dri-devel@lists.freedesktop.org,
linux-kernel@vger.kernel.org, Lu Yao <yaolu@kylinos.cn>
Subject: Re: [PATCH] drm/i915: Handle null 'fb' in 'intel_plane_atomic_check_with_state'
Date: Mon, 20 Jan 2025 12:39:00 +0200 [thread overview]
Message-ID: <87h65trcqj.fsf@intel.com> (raw)
In-Reply-To: <20250120053908.94339-1-yaolu@kylinos.cn>
On Mon, 20 Jan 2025, Lu Yao <yaolu@kylinos.cn> wrote:
> Add null pointer check before use fb.
> Reported by smatch.
If new_plane_state->uapi.visible is true, fb will be non-NULL too, but
smatch is unable to see that.
Adding these checks makes one believe that this is not something you can
rely on.
BR,
Jani.
>
> Signed-off-by: Lu Yao <yaolu@kylinos.cn>
> ---
> drivers/gpu/drm/i915/display/intel_atomic_plane.c | 6 +++---
> 1 file changed, 3 insertions(+), 3 deletions(-)
>
> diff --git a/drivers/gpu/drm/i915/display/intel_atomic_plane.c b/drivers/gpu/drm/i915/display/intel_atomic_plane.c
> index d89630b2d5c1..20bfa9589ee7 100644
> --- a/drivers/gpu/drm/i915/display/intel_atomic_plane.c
> +++ b/drivers/gpu/drm/i915/display/intel_atomic_plane.c
> @@ -640,18 +640,18 @@ int intel_plane_atomic_check_with_state(const struct intel_crtc_state *old_crtc_
> intel_plane_is_scaled(new_plane_state))
> new_crtc_state->scaled_planes |= BIT(plane->id);
>
> - if (new_plane_state->uapi.visible &&
> + if (fb && new_plane_state->uapi.visible &&
> intel_format_info_is_yuv_semiplanar(fb->format, fb->modifier))
> new_crtc_state->nv12_planes |= BIT(plane->id);
>
> - if (new_plane_state->uapi.visible &&
> + if (fb && new_plane_state->uapi.visible &&
> fb->format->format == DRM_FORMAT_C8)
> new_crtc_state->c8_planes |= BIT(plane->id);
>
> if (new_plane_state->uapi.visible || old_plane_state->uapi.visible)
> new_crtc_state->update_planes |= BIT(plane->id);
>
> - if (new_plane_state->uapi.visible &&
> + if (fb && new_plane_state->uapi.visible &&
> intel_format_info_is_yuv_semiplanar(fb->format, fb->modifier)) {
> new_crtc_state->data_rate_y[plane->id] =
> intel_plane_data_rate(new_crtc_state, new_plane_state, 0);
--
Jani Nikula, Intel
next prev parent reply other threads:[~2025-01-20 10:39 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-01-20 5:39 [PATCH] drm/i915: Handle null 'fb' in 'intel_plane_atomic_check_with_state' Lu Yao
2025-01-20 10:39 ` Jani Nikula [this message]
2025-01-21 17:57 ` ✗ i915.CI.BAT: failure for " Patchwork
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=87h65trcqj.fsf@intel.com \
--to=jani.nikula@linux.intel.com \
--cc=dri-devel@lists.freedesktop.org \
--cc=intel-gfx@lists.freedesktop.org \
--cc=joonas.lahtinen@linux.intel.com \
--cc=linux-kernel@vger.kernel.org \
--cc=rodrigo.vivi@intel.com \
--cc=tursulin@ursulin.net \
--cc=yaolu@kylinos.cn \
/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