Skip to contentSkip to conversation

drm/i915: Handle null 'fb' in 'intel_plane_atomic_check_with_state'

PATCH In review Lu Yao 3 participants 3 messages Jan 20, 2025 – Jan 21, 2025

Subsystems (3)
lore
Share & tools
lore

Lu Yao

author
#0 lore raw

PATCH 1/1 drm/i915: Handle null 'fb' in 'intel_plane_atomic_check_with_state'

Add null pointer check before use fb.
Reported by smatch.

---
 drivers/gpu/drm/i915/display/intel_atomic_plane.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)
drivers/gpu/drm/i915/display/intel_atomic_plane.c +3 -3
index d89630b2d5c1..20bfa9589ee7 100644
@@ -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);
Signature · 1 line
2.25.1
maintainer
#1 lore raw
Quoted 2 lines · Lu Yao

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.

Quoted 32 lines
---
 drivers/gpu/drm/i915/display/intel_atomic_plane.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)
drivers/gpu/drm/i915/display/intel_atomic_plane.c +3 -3
index d89630b2d5c1..20bfa9589ee7 100644
@@ -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);
Signature · 1 line
Jani Nikula, Intel
#2 lore raw

✗ i915.CI.BAT: failure for drm/i915: Handle null 'fb' in 'intel_plane_atomic_check_with_state'

In reply to Lu Yao
== Series Details ==

== Series Details ==

Series: drm/i915: Handle null 'fb' in 'intel_plane_atomic_check_with_state'
URL : https://patchwork.freedesktop.org/series/143795/
State : failure

== Summary ==

CI Bug Log - changes from CI_DRM_15992 -> Patchwork_143795v1
====================================================

Summary
-------

**FAILURE**

Serious unknown changes coming with Patchwork_143795v1 absolutely need to be verified manually.

If you think the reported changes have nothing to do with the changes
introduced in Patchwork_143795v1, please notify your bug team ([email protected]) to allow them to document this new failure mode, which will reduce false positives in CI.

External URL: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_143795v1/index.html

Participating hosts (39 -> 39)
------------------------------

No changes in participating hosts

Possible new issues
-------------------

Here are the unknown changes that may have been introduced in Patchwork_143795v1:

### IGT changes ###

#### Possible regressions ####

* igt@kms_flip@basic-plain-flip:
- fi-cfl-8109u: [PASS][1] -> [DMESG-WARN][2] +3 other tests dmesg-warn
[1]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_15992/fi-cfl-8109u/igt@[email protected]
[2]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_143795v1/fi-cfl-8109u/igt@[email protected]

Known issues
------------

Here are the changes found in Patchwork_143795v1 that come from known issues:

### IGT changes ###

#### Issues hit ####

* igt@i915_pm_rpm@module-reload:
- bat-dg1-7: [PASS][3] -> [FAIL][4] ([i915#13401])
[3]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_15992/bat-dg1-7/igt@[email protected]
[4]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_143795v1/bat-dg1-7/igt@[email protected]

* igt@kms_pipe_crc_basic@nonblocking-crc-frame-sequence:
- bat-dg2-11: [PASS][5] -> [SKIP][6] ([i915#9197]) +3 other tests skip
[5]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_15992/bat-dg2-11/igt@[email protected]
[6]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_143795v1/bat-dg2-11/igt@[email protected]

#### Possible fixes ####

* igt@i915_selftest@live:
- bat-mtlp-8: [DMESG-FAIL][7] ([i915#12061]) -> [PASS][8] +1 other test pass
[7]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_15992/bat-mtlp-8/igt@[email protected]
[8]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_143795v1/bat-mtlp-8/igt@[email protected]
- bat-adlp-11: [ABORT][9] ([i915#13399]) -> [PASS][10]
[9]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_15992/bat-adlp-11/igt@[email protected]
[10]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_143795v1/bat-adlp-11/igt@[email protected]

* igt@i915_selftest@live@guc:
- bat-adlp-11: [ABORT][11] -> [PASS][12]
[11]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_15992/bat-adlp-11/igt@i915_selftest@[email protected]
[12]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_143795v1/bat-adlp-11/igt@i915_selftest@[email protected]

* igt@i915_selftest@live@workarounds:
- {bat-arls-6}: [DMESG-FAIL][13] ([i915#12061]) -> [PASS][14] +1 other test pass
[13]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_15992/bat-arls-6/igt@i915_selftest@[email protected]
[14]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_143795v1/bat-arls-6/igt@i915_selftest@[email protected]

{name}: This element is suppressed. This means it is ignored when computing
the status of the difference (SUCCESS, WARNING, or FAILURE).

[i915#12061]: https://gitlab.freedesktop.org/drm/i915/kernel/-/issues/12061
[i915#13399]: https://gitlab.freedesktop.org/drm/i915/kernel/-/issues/13399
[i915#13401]: https://gitlab.freedesktop.org/drm/i915/kernel/-/issues/13401
[i915#9197]: https://gitlab.freedesktop.org/drm/i915/kernel/-/issues/9197

Build changes
-------------

* Linux: CI_DRM_15992 -> Patchwork_143795v1

CI-20190529: 20190529
CI_DRM_15992: d471f521da387883809f72b139a2013c0652bee1 @ git://anongit.freedesktop.org/gfx-ci/linux
IGT_8203: 3dce04be4ed4c0e729d80f70caff8ae8a869b5c0 @ https://gitlab.freedesktop.org/drm/igt-gpu-tools.git
Patchwork_143795v1: d471f521da387883809f72b139a2013c0652bee1 @ git://anongit.freedesktop.org/gfx-ci/linux

== Logs ==

For more details see: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_143795v1/index.html