Re: [PATCH] ramdac: Check sPriv != NULL in xf86CheckHWCursor()
Hi, On 25-10-16 00:25, Alex Goins wrote: xf86CheckHWCursor() would dereference sPriv without NULL checking it. If Option "SWCursor" is specified, sPriv == NULL. In this case we should assume that HW cursors are not supported. Signed-off-by: Alex GoinsReviewed-by: Andy Ritger Patch looks good to me: Reviewed-by: Hans de Goede Regards, Hans --- hw/xfree86/ramdac/xf86HWCurs.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/hw/xfree86/ramdac/xf86HWCurs.c b/hw/xfree86/ramdac/xf86HWCurs.c index da2b181..5e99526 100644 --- a/hw/xfree86/ramdac/xf86HWCurs.c +++ b/hw/xfree86/ramdac/xf86HWCurs.c @@ -148,7 +148,8 @@ xf86CheckHWCursor(ScreenPtr pScreen, CursorPtr cursor, xf86CursorInfoPtr infoPtr continue; sPriv = dixLookupPrivate(>devPrivates, xf86CursorScreenKey); -if (!xf86ScreenCheckHWCursor(pSlave, cursor, sPriv->CursorInfoPtr)) +if (!sPriv || +!xf86ScreenCheckHWCursor(pSlave, cursor, sPriv->CursorInfoPtr)) return FALSE; } return TRUE; ___ xorg-devel@lists.x.org: X.Org development Archives: http://lists.x.org/archives/xorg-devel Info: https://lists.x.org/mailman/listinfo/xorg-devel
Re: [PATCH] ramdac: Check sPriv != NULL in xf86CheckHWCursor()
Am 25.10.2016 00:25, schrieb Alex Goins: > xf86CheckHWCursor() would dereference sPriv without NULL checking it. If > Option > "SWCursor" is specified, sPriv == NULL. In this case we should assume that HW > cursors are not supported. > > Signed-off-by: Alex Goins> Reviewed-by: Andy Ritger > --- > hw/xfree86/ramdac/xf86HWCurs.c | 3 ++- > 1 file changed, 2 insertions(+), 1 deletion(-) > > diff --git a/hw/xfree86/ramdac/xf86HWCurs.c b/hw/xfree86/ramdac/xf86HWCurs.c > index da2b181..5e99526 100644 > --- a/hw/xfree86/ramdac/xf86HWCurs.c > +++ b/hw/xfree86/ramdac/xf86HWCurs.c > @@ -148,7 +148,8 @@ xf86CheckHWCursor(ScreenPtr pScreen, CursorPtr cursor, > xf86CursorInfoPtr infoPtr > continue; > > sPriv = dixLookupPrivate(>devPrivates, xf86CursorScreenKey); > -if (!xf86ScreenCheckHWCursor(pSlave, cursor, sPriv->CursorInfoPtr)) > +if (!sPriv || > +!xf86ScreenCheckHWCursor(pSlave, cursor, sPriv->CursorInfoPtr)) > return FALSE; > } > return TRUE; I would go for 2 lines that will make things more clear also adding a comment would help future debugging operations. 1. if (!sPriv) return FALSE; /* maybe option "SWCursor" */ 2. if (!xf86ScreenCheckHWCursor(pSlave, cursor, sPriv->CursorInfoPtr)) /* HWCursor not supported */ just my 2 cents, re, wh ___ xorg-devel@lists.x.org: X.Org development Archives: http://lists.x.org/archives/xorg-devel Info: https://lists.x.org/mailman/listinfo/xorg-devel
[PATCH] ramdac: Check sPriv != NULL in xf86CheckHWCursor()
xf86CheckHWCursor() would dereference sPriv without NULL checking it. If Option "SWCursor" is specified, sPriv == NULL. In this case we should assume that HW cursors are not supported. Signed-off-by: Alex GoinsReviewed-by: Andy Ritger --- hw/xfree86/ramdac/xf86HWCurs.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/hw/xfree86/ramdac/xf86HWCurs.c b/hw/xfree86/ramdac/xf86HWCurs.c index da2b181..5e99526 100644 --- a/hw/xfree86/ramdac/xf86HWCurs.c +++ b/hw/xfree86/ramdac/xf86HWCurs.c @@ -148,7 +148,8 @@ xf86CheckHWCursor(ScreenPtr pScreen, CursorPtr cursor, xf86CursorInfoPtr infoPtr continue; sPriv = dixLookupPrivate(>devPrivates, xf86CursorScreenKey); -if (!xf86ScreenCheckHWCursor(pSlave, cursor, sPriv->CursorInfoPtr)) +if (!sPriv || +!xf86ScreenCheckHWCursor(pSlave, cursor, sPriv->CursorInfoPtr)) return FALSE; } return TRUE; -- 1.9.1 ___ xorg-devel@lists.x.org: X.Org development Archives: http://lists.x.org/archives/xorg-devel Info: https://lists.x.org/mailman/listinfo/xorg-devel