All of lore.kernel.org
 help / color / mirror / Atom feed
From: Rodrigo Vivi <rodrigo.vivi@intel.com>
To: Markus Elfring <Markus.Elfring@web.de>
Cc: intel-gfx@lists.freedesktop.org, intel-xe@lists.freedesktop.org,
	dri-devel@lists.freedesktop.org,
	"David Airlie" <airlied@gmail.com>,
	"Jani Nikula" <jani.nikula@linux.intel.com>,
	"Joonas Lahtinen" <joonas.lahtinen@linux.intel.com>,
	"Simona Vetter" <simona@ffwll.ch>,
	"Tvrtko Ursulin" <tursulin@ursulin.net>,
	"Ville Syrjälä" <ville.syrjala@linux.intel.com>,
	LKML <linux-kernel@vger.kernel.org>,
	kernel-janitors@vger.kernel.org
Subject: Re: [PATCH] drm/i915/bios: Move a variable assignment behind a null pointer check in intel_bios_encoder_supports_dp_dual_mode()
Date: Tue, 14 Jul 2026 11:28:23 -0400	[thread overview]
Message-ID: <alZVl0o7uBoncUos@intel.com> (raw)
In-Reply-To: <e81277a0-93f8-45e9-9fa4-7c2c2df9c311@web.de>

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
> 

  parent reply	other threads:[~2026-07-14 15:28 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
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 14:52 ` Patchwork
2026-07-14 15:28 ` Rodrigo Vivi [this message]
2026-07-14 15:46   ` [PATCH] " Dan Carpenter
2026-07-14 16:10     ` Markus Elfring

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=alZVl0o7uBoncUos@intel.com \
    --to=rodrigo.vivi@intel.com \
    --cc=Markus.Elfring@web.de \
    --cc=airlied@gmail.com \
    --cc=dri-devel@lists.freedesktop.org \
    --cc=intel-gfx@lists.freedesktop.org \
    --cc=intel-xe@lists.freedesktop.org \
    --cc=jani.nikula@linux.intel.com \
    --cc=joonas.lahtinen@linux.intel.com \
    --cc=kernel-janitors@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=simona@ffwll.ch \
    --cc=tursulin@ursulin.net \
    --cc=ville.syrjala@linux.intel.com \
    /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.