All of lore.kernel.org
 help / color / mirror / Atom feed
From: Jani Nikula <jani.nikula@linux.intel.com>
To: Ma Ke <make_ruc2021@163.com>,
	maarten.lankhorst@linux.intel.com, mripard@kernel.org,
	tzimmermann@suse.de, airlied@gmail.com, daniel@ffwll.ch
Cc: linux-kernel@vger.kernel.org, dri-devel@lists.freedesktop.org,
	Ma Ke <make_ruc2021@163.com>
Subject: Re: [PATCH] drm/edid: fix a possible null pointer dereference
Date: Wed, 11 Oct 2023 10:10:30 +0300	[thread overview]
Message-ID: <874jix63dl.fsf@intel.com> (raw)
In-Reply-To: <20231011013316.4091845-1-make_ruc2021@163.com>

On Wed, 11 Oct 2023, Ma Ke <make_ruc2021@163.com> wrote:
> In drm_mode_std(), the return value of drm_gtf_mode(),
> drm_gtf_mode() and drm_cvt_mode() is assigned to mode,
> which will lead to a NULL pointer dereference on failure
> of drm_gtf_mode(), drm_gtf_mode() and drm_cvt_mode().
> Add a check to avoid null point dereference.
>
> Signed-off-by: Ma Ke <make_ruc2021@163.com>
> ---
>  drivers/gpu/drm/drm_edid.c | 2 ++
>  1 file changed, 2 insertions(+)
>
> diff --git a/drivers/gpu/drm/drm_edid.c b/drivers/gpu/drm/drm_edid.c
> index 340da8257b51..e2c154c2b896 100644
> --- a/drivers/gpu/drm/drm_edid.c
> +++ b/drivers/gpu/drm/drm_edid.c
> @@ -3381,6 +3381,8 @@ static struct drm_display_mode *drm_mode_std(struct drm_connector *connector,
>  				    false);
>  		break;
>  	}
> +	if (!mode)
> +		return NULL;

This doesn't change anything.

BR,
Jani.


>  	return mode;
>  }

-- 
Jani Nikula, Intel

      reply	other threads:[~2023-10-11  7:10 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-10-11  1:33 [PATCH] drm/edid: fix a possible null pointer dereference Ma Ke
2023-10-11  1:33 ` Ma Ke
2023-10-11  7:10 ` Jani Nikula [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=874jix63dl.fsf@intel.com \
    --to=jani.nikula@linux.intel.com \
    --cc=airlied@gmail.com \
    --cc=daniel@ffwll.ch \
    --cc=dri-devel@lists.freedesktop.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=maarten.lankhorst@linux.intel.com \
    --cc=make_ruc2021@163.com \
    --cc=mripard@kernel.org \
    --cc=tzimmermann@suse.de \
    /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.