[Bug 267606] x11-drivers/xf86-video-nv: Segmentation Fault post update from 1.20.14,1 to 21.1.4

From: <bugzilla-noreply_at_freebsd.org>
Date: Wed, 24 Jan 2024 03:11:07 UTC
https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=267606

Yusuf Khan <yusisamerican@gmail.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
 Attachment #247909|0                           |1
           is patch|                            |
 Attachment #247909|1                           |0
        is obsolete|                            |
 Attachment #247909|Patch that would            |Patch that would
        description|pressumably let the         |pressumably let the
                   |strcmp() pass               |strcmp() pass, edited as
                   |                            |previous patch was not
                   |                            |correct.

--- Comment #42 from Yusuf Khan <yusisamerican@gmail.com> ---
Comment on attachment 247909
  --> https://bugs.freebsd.org/bugzilla/attachment.cgi?id=247909
Patch that would pressumably let the strcmp() pass, edited as previous patch
was not correct.

>From 9ac823cf803c842c4455714f8a7899dc6f59e7f6 Mon Sep 17 00:00:00 2001
>From: Yusuf Khan <yusisamerican@gmail.com>
>Date: Tue, 23 Jan 2024 16:41:45 -0800
>Subject: [PATCH xf86-video-nv] nv/init: set default names and crt before
> validation
>
>Presumably would fix https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=267606,
>a segfault probably resulting from the lack of a name on the modes.
>
>Signed-off-by: Yusuf Khan <yusisamerican@gmail.com>
>---
> src/nv_driver.c | 22 ++++++++++++++++++++++
> 1 file changed, 22 insertions(+)
>
>diff --git a/src/nv_driver.c b/src/nv_driver.c
>index d2634da..4f50aa4 100644
>--- a/src/nv_driver.c
>+++ b/src/nv_driver.c
>@@ -1339,6 +1339,27 @@ NVModesAdd(DisplayModePtr Modes, DisplayModePtr Additions)
>     return Modes;
> }
> 
>+/* Sometimes we need info from here and we dont get it for whatever reason */
>+static void
>+NVSetModesInfo(DisplayModePtr Modes, int adjustFlags)
>+{
>+    DisplayModePtr Mode;
>+
>+    if (!Modes) {
>+        return;
>+    }
>+
>+    Mode = Modes;
>+
>+    while (Modes->next) {
>+	Mode = Mode->next;
>+	xf86SetModeDefaultName(Mode);
>+	xf86SetModeCrtc(Mode, adjustFlags);
>+    }
>+
>+    return;
>+}
>+
> /* Mandatory */
> static Bool
> NVPreInit(ScrnInfoPtr pScrn, int flags)
>@@ -1975,6 +1996,7 @@ NVPreInit(ScrnInfoPtr pScrn, int flags)
>         if (i > 0)
>             VBESetModeParameters(pScrn, pNv->pVbe);
>     } else {
>+	NVSetModesInfo(pScrn->monitor->Modes, pScrn->adjustFlags);
>         i = xf86ValidateModes(pScrn, pScrn->monitor->Modes,
>                               pScrn->display->modes, clockRanges,
>                               NULL, 256, max_width,
>-- 
>2.43.0
>

-- 
You are receiving this mail because:
You are on the CC list for the bug.
You are the assignee for the bug.