Intel-XE Archive on lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] drm/i915/bios: Move a variable assignment behind a null pointer check in intel_bios_encoder_supports_dp_dual_mode()
@ 2026-07-13 14:05 Markus Elfring
  2026-07-14 14:09 ` ✗ LGCI.VerificationFailed: failure for " Patchwork
  2026-07-14 15:28 ` [PATCH] " Rodrigo Vivi
  0 siblings, 2 replies; 4+ messages in thread
From: Markus Elfring @ 2026-07-13 14:05 UTC (permalink / raw)
  To: intel-gfx, intel-xe, dri-devel, David Airlie, Jani Nikula,
	Joonas Lahtinen, Rodrigo Vivi, Simona Vetter, Tvrtko Ursulin,
	Ville Syrjälä
  Cc: LKML, kernel-janitors

From: Markus Elfring <elfring@users.sourceforge.net>
Date: Mon, 13 Jul 2026 15:56:46 +0200

The address of a data structure member was determined before
a corresponding null pointer check in the implementation of
the function “intel_bios_encoder_supports_dp_dual_mode”.

Thus avoid the risk for undefined behaviour by reducing the scope for
the variable “child” behind condition checks.

This issue was detected by using the Coccinelle software.

Fixes: 044cbc7a74c136f12a80c855cadd1b085084aef1 ("drm/i915/bios: Nuke DEVICE_TYPE_DP_DUAL_MODE_BITS")
Cc: stable@vger.kernel.org
Signed-off-by: Markus Elfring <elfring@users.sourceforge.net>
---
 drivers/gpu/drm/i915/display/intel_bios.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/gpu/drm/i915/display/intel_bios.c b/drivers/gpu/drm/i915/display/intel_bios.c
index 97cbae2e547e..1c4760373514 100644
--- a/drivers/gpu/drm/i915/display/intel_bios.c
+++ b/drivers/gpu/drm/i915/display/intel_bios.c
@@ -3514,8 +3514,6 @@ bool intel_bios_is_port_present(struct intel_display *display, enum port port)
 
 bool intel_bios_encoder_supports_dp_dual_mode(const struct intel_bios_encoder_data *devdata)
 {
-	const struct child_device_config *child = &devdata->child;
-
 	if (!devdata)
 		return false;
 
@@ -3523,6 +3521,8 @@ bool intel_bios_encoder_supports_dp_dual_mode(const struct intel_bios_encoder_da
 	    !intel_bios_encoder_supports_hdmi(devdata))
 		return false;
 
+	const struct child_device_config *child = &devdata->child;
+
 	if (dvo_port_type(child->dvo_port) == DVO_PORT_DPA)
 		return true;
 
-- 
2.55.0


^ permalink raw reply related	[flat|nested] 4+ messages in thread

* ✗ LGCI.VerificationFailed: failure for drm/i915/bios: Move a variable assignment behind a null pointer check in intel_bios_encoder_supports_dp_dual_mode()
  2026-07-13 14:05 [PATCH] drm/i915/bios: Move a variable assignment behind a null pointer check in intel_bios_encoder_supports_dp_dual_mode() Markus Elfring
@ 2026-07-14 14:09 ` Patchwork
  2026-07-14 15:28 ` [PATCH] " Rodrigo Vivi
  1 sibling, 0 replies; 4+ messages in thread
From: Patchwork @ 2026-07-14 14:09 UTC (permalink / raw)
  To: Markus Elfring; +Cc: intel-xe

== Series Details ==

Series: drm/i915/bios: Move a variable assignment behind a null pointer check in intel_bios_encoder_supports_dp_dual_mode()
URL   : https://patchwork.freedesktop.org/series/170414/
State : failure

== Summary ==

Series author address 'markus.elfring@web.de' is not on the allowlist, which prevents CI from being automatically triggered.
If you want CI to run for this series, ask Patchwork project owners to click 'retest' on the series in Patchwork.
Exception occurred during validation, bailing out!
Build URL: http://intel-gfx-ci-public.igk.intel.com:8080/job/xe_pw_trigger/1215553/ (on master)



^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] drm/i915/bios: Move a variable assignment behind a null pointer check in intel_bios_encoder_supports_dp_dual_mode()
  2026-07-13 14:05 [PATCH] drm/i915/bios: Move a variable assignment behind a null pointer check in intel_bios_encoder_supports_dp_dual_mode() Markus Elfring
  2026-07-14 14:09 ` ✗ LGCI.VerificationFailed: failure for " Patchwork
@ 2026-07-14 15:28 ` Rodrigo Vivi
  2026-07-14 15:46   ` Dan Carpenter
  1 sibling, 1 reply; 4+ messages in thread
From: Rodrigo Vivi @ 2026-07-14 15:28 UTC (permalink / raw)
  To: Markus Elfring
  Cc: intel-gfx, intel-xe, dri-devel, David Airlie, Jani Nikula,
	Joonas Lahtinen, Simona Vetter, Tvrtko Ursulin,
	Ville Syrjälä, LKML, kernel-janitors

On Mon, Jul 13, 2026 at 04:05:53PM +0200, Markus Elfring wrote:
> From: Markus Elfring <elfring@users.sourceforge.net>
> Date: Mon, 13 Jul 2026 15:56:46 +0200
> 
> The address of a data structure member was determined before
> a corresponding null pointer check in the implementation of
> the function “intel_bios_encoder_supports_dp_dual_mode”.
> 
> Thus avoid the risk for undefined behaviour by reducing the scope for
> the variable “child” behind condition checks.
> 
> This issue was detected by using the Coccinelle software.
> 
> Fixes: 044cbc7a74c136f12a80c855cadd1b085084aef1 ("drm/i915/bios: Nuke DEVICE_TYPE_DP_DUAL_MODE_BITS")
> Cc: stable@vger.kernel.org
> Signed-off-by: Markus Elfring <elfring@users.sourceforge.net>
> ---
>  drivers/gpu/drm/i915/display/intel_bios.c | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/gpu/drm/i915/display/intel_bios.c b/drivers/gpu/drm/i915/display/intel_bios.c
> index 97cbae2e547e..1c4760373514 100644
> --- a/drivers/gpu/drm/i915/display/intel_bios.c
> +++ b/drivers/gpu/drm/i915/display/intel_bios.c
> @@ -3514,8 +3514,6 @@ bool intel_bios_is_port_present(struct intel_display *display, enum port port)
>  
>  bool intel_bios_encoder_supports_dp_dual_mode(const struct intel_bios_encoder_data *devdata)
>  {
> -	const struct child_device_config *child = &devdata->child;
> -
>  	if (!devdata)
>  		return false;
>  
> @@ -3523,6 +3521,8 @@ bool intel_bios_encoder_supports_dp_dual_mode(const struct intel_bios_encoder_da
>  	    !intel_bios_encoder_supports_hdmi(devdata))
>  		return false;
>  
> +	const struct child_device_config *child = &devdata->child;
> +

does it compile?

please keep the variable definition where it is and move only its
assignment after the null check.

Thanks,
Rodrigo.

>  	if (dvo_port_type(child->dvo_port) == DVO_PORT_DPA)
>  		return true;
>  
> -- 
> 2.55.0
> 

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] drm/i915/bios: Move a variable assignment behind a null pointer check in intel_bios_encoder_supports_dp_dual_mode()
  2026-07-14 15:28 ` [PATCH] " Rodrigo Vivi
@ 2026-07-14 15:46   ` Dan Carpenter
  0 siblings, 0 replies; 4+ messages in thread
From: Dan Carpenter @ 2026-07-14 15:46 UTC (permalink / raw)
  To: Rodrigo Vivi
  Cc: Markus Elfring, intel-gfx, intel-xe, dri-devel, David Airlie,
	Jani Nikula, Joonas Lahtinen, Simona Vetter, Tvrtko Ursulin,
	Ville Syrjälä, LKML, kernel-janitors

On Tue, Jul 14, 2026 at 11:28:23AM -0400, Rodrigo Vivi wrote:
> On Mon, Jul 13, 2026 at 04:05:53PM +0200, Markus Elfring wrote:
> > From: Markus Elfring <elfring@users.sourceforge.net>
> > Date: Mon, 13 Jul 2026 15:56:46 +0200
> > 
> > The address of a data structure member was determined before
> > a corresponding null pointer check in the implementation of
> > the function “intel_bios_encoder_supports_dp_dual_mode”.
> > 
> > Thus avoid the risk for undefined behaviour by reducing the scope for
> > the variable “child” behind condition checks.
> > 
> > This issue was detected by using the Coccinelle software.
> > 
> > Fixes: 044cbc7a74c136f12a80c855cadd1b085084aef1 ("drm/i915/bios: Nuke DEVICE_TYPE_DP_DUAL_MODE_BITS")
> > Cc: stable@vger.kernel.org

Please stop adding Fixes tags to these and talking about "undefined
behavior" in the commit message.  Pointer math is defined...  It's
just a style preference on your part.

regards,
dan carpenter


^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2026-07-14 15:46 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-07-13 14:05 [PATCH] drm/i915/bios: Move a variable assignment behind a null pointer check in intel_bios_encoder_supports_dp_dual_mode() Markus Elfring
2026-07-14 14:09 ` ✗ LGCI.VerificationFailed: failure for " Patchwork
2026-07-14 15:28 ` [PATCH] " Rodrigo Vivi
2026-07-14 15:46   ` Dan Carpenter

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox