linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Danilo Krummrich <dakr@redhat.com>
To: Ma Ke <make_ruc2021@163.com>
Cc: kherbst@redhat.com, lyude@redhat.com, airlied@gmail.com,
	daniel@ffwll.ch, noralf@tronnes.org, tzimmermann@suse.de,
	mripard@kernel.org, jani.nikula@intel.com,
	nouveau@lists.freedesktop.org, linux-kernel@vger.kernel.org,
	dri-devel@lists.freedesktop.org
Subject: Re: [PATCH] drm/nouveau/dispnv04: fix a possible null pointer dereference
Date: Thu, 12 Oct 2023 19:58:01 +0200	[thread overview]
Message-ID: <78f3a73d-3c2a-4432-8ac5-9e4418f509cb@redhat.com> (raw)
In-Reply-To: <20231007032349.3997387-1-make_ruc2021@163.com>

On 10/7/23 05:23, Ma Ke wrote:
> In nv17_tv_get_ld_modes(), the return value of drm_mode_duplicate()
> is assigned to mode, which will lead to a NULL pointer dereference
> on failure of drm_mode_duplicate(). Add a check to avoid npd.
> 
> Signed-off-by: Ma Ke <make_ruc2021@163.com>

Reviewed-by: Danilo Krummrich <dakr@redhat.com>

> ---
>   drivers/gpu/drm/nouveau/dispnv04/tvnv17.c | 2 ++
>   1 file changed, 2 insertions(+)
> 
> diff --git a/drivers/gpu/drm/nouveau/dispnv04/tvnv17.c b/drivers/gpu/drm/nouveau/dispnv04/tvnv17.c
> index 670c9739e5e1..4a08e61f3336 100644
> --- a/drivers/gpu/drm/nouveau/dispnv04/tvnv17.c
> +++ b/drivers/gpu/drm/nouveau/dispnv04/tvnv17.c
> @@ -209,6 +209,8 @@ static int nv17_tv_get_ld_modes(struct drm_encoder *encoder,
>   		struct drm_display_mode *mode;
>   
>   		mode = drm_mode_duplicate(encoder->dev, tv_mode);
> +		if (!mode)
> +			continue;
>   
>   		mode->clock = tv_norm->tv_enc_mode.vrefresh *
>   			mode->htotal / 1000 *


  reply	other threads:[~2023-10-12 17:58 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-10-07  3:23 [PATCH] drm/nouveau/dispnv04: fix a possible null pointer dereference Ma Ke
2023-10-12 17:58 ` Danilo Krummrich [this message]
2023-10-13  1:18 Ma Ke

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=78f3a73d-3c2a-4432-8ac5-9e4418f509cb@redhat.com \
    --to=dakr@redhat.com \
    --cc=airlied@gmail.com \
    --cc=daniel@ffwll.ch \
    --cc=dri-devel@lists.freedesktop.org \
    --cc=jani.nikula@intel.com \
    --cc=kherbst@redhat.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=lyude@redhat.com \
    --cc=make_ruc2021@163.com \
    --cc=mripard@kernel.org \
    --cc=noralf@tronnes.org \
    --cc=nouveau@lists.freedesktop.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).