mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Lyude Paul <lyude@redhat.com>
To: Natalia Petrova <n.petrova@fintech.ru>, Ben Skeggs <bskeggs@redhat.com>
Cc: Karol Herbst <kherbst@redhat.com>,
	David Airlie <airlied@gmail.com>, Daniel Vetter <daniel@ffwll.ch>,
	dri-devel@lists.freedesktop.org, nouveau@lists.freedesktop.org,
	linux-kernel@vger.kernel.org, lvc-project@linuxtesting.org
Subject: Re: [PATCH] drm/nouveau/dp: check for NULL nv_connector->native_mode
Date: Tue, 13 Jun 2023 16:40:17 -0400	[thread overview]
Message-ID: <c2bf9c25b5ba7d00cc476ed1389ad5e2dd9b2491.camel@redhat.com> (raw)
In-Reply-To: <20230512111526.82408-1-n.petrova@fintech.ru>

Reviewed-by: Lyude Paul <lyude@redhat.com>

Will push upstream in a bit

On Fri, 2023-05-12 at 14:15 +0300, Natalia Petrova wrote:
> Add checking for NULL before calling nouveau_connector_detect_depth() in
> nouveau_connector_get_modes() function because nv_connector->native_mode
> could be dereferenced there since connector pointer passed to
> nouveau_connector_detect_depth() and the same value of
> nv_connector->native_mode is used there.
> 
> Found by Linux Verification Center (linuxtesting.org) with SVACE.
> 
> Fixes: d4c2c99bdc83 ("drm/nouveau/dp: remove broken display depth function, use the improved one")
> 
> Signed-off-by: Natalia Petrova <n.petrova@fintech.ru>
> ---
>  drivers/gpu/drm/nouveau/nouveau_connector.c | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/gpu/drm/nouveau/nouveau_connector.c b/drivers/gpu/drm/nouveau/nouveau_connector.c
> index 086b66b60d91..5dbf025e6873 100644
> --- a/drivers/gpu/drm/nouveau/nouveau_connector.c
> +++ b/drivers/gpu/drm/nouveau/nouveau_connector.c
> @@ -966,7 +966,7 @@ nouveau_connector_get_modes(struct drm_connector *connector)
>  	/* Determine display colour depth for everything except LVDS now,
>  	 * DP requires this before mode_valid() is called.
>  	 */
> -	if (connector->connector_type != DRM_MODE_CONNECTOR_LVDS)
> +	if (connector->connector_type != DRM_MODE_CONNECTOR_LVDS && nv_connector->native_mode)
>  		nouveau_connector_detect_depth(connector);
>  
>  	/* Find the native mode if this is a digital panel, if we didn't
> @@ -987,7 +987,7 @@ nouveau_connector_get_modes(struct drm_connector *connector)
>  	 * "native" mode as some VBIOS tables require us to use the
>  	 * pixel clock as part of the lookup...
>  	 */
> -	if (connector->connector_type == DRM_MODE_CONNECTOR_LVDS)
> +	if (connector->connector_type == DRM_MODE_CONNECTOR_LVDS && nv_connector->native_mode)
>  		nouveau_connector_detect_depth(connector);
>  
>  	if (nv_encoder->dcb->type == DCB_OUTPUT_TV)

-- 
Cheers,
 Lyude Paul (she/her)
 Software Engineer at Red Hat


      reply	other threads:[~2023-06-13 20:41 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-05-12 11:15 Natalia Petrova
2023-06-13 20:40 ` Lyude Paul [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=c2bf9c25b5ba7d00cc476ed1389ad5e2dd9b2491.camel@redhat.com \
    --to=lyude@redhat.com \
    --cc=airlied@gmail.com \
    --cc=bskeggs@redhat.com \
    --cc=daniel@ffwll.ch \
    --cc=dri-devel@lists.freedesktop.org \
    --cc=kherbst@redhat.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=lvc-project@linuxtesting.org \
    --cc=n.petrova@fintech.ru \
    --cc=nouveau@lists.freedesktop.org \
    /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

all inboxes | Powered by JetHome®