* [PATCH] drm/vmwgfx: Use correct vmw_legacy_display_unit pointer
@ 2020-06-26 10:34 Dan Carpenter
2020-07-14 1:16 ` Roland Scheidegger
0 siblings, 1 reply; 2+ messages in thread
From: Dan Carpenter @ 2020-06-26 10:34 UTC (permalink / raw)
To: VMware Graphics, Jakob Bornecrantz
Cc: Thomas Hellstrom, David Airlie, kernel-janitors,
Roland Scheidegger, dri-devel, Dave Airlie
The "entry" pointer is an offset from the list head and it doesn't
point to a valid vmw_legacy_display_unit struct. Presumably the
intent was to point to the last entry.
Also the "i++" wasn't used so I have removed that as well.
Fixes: d7e1958dbe4a ("drm/vmwgfx: Support older hardware.")
Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
---
From static analysis. Not tested. This bug celebrated its tenth
birthday last month. :)
drivers/gpu/drm/vmwgfx/vmwgfx_ldu.c | 5 ++---
1 file changed, 2 insertions(+), 3 deletions(-)
diff --git a/drivers/gpu/drm/vmwgfx/vmwgfx_ldu.c b/drivers/gpu/drm/vmwgfx/vmwgfx_ldu.c
index 16dafff5cab1..009f1742bed5 100644
--- a/drivers/gpu/drm/vmwgfx/vmwgfx_ldu.c
+++ b/drivers/gpu/drm/vmwgfx/vmwgfx_ldu.c
@@ -81,7 +81,7 @@ static int vmw_ldu_commit_list(struct vmw_private *dev_priv)
struct vmw_legacy_display_unit *entry;
struct drm_framebuffer *fb = NULL;
struct drm_crtc *crtc = NULL;
- int i = 0;
+ int i;
/* If there is no display topology the host just assumes
* that the guest will set the same layout as the host.
@@ -92,12 +92,11 @@ static int vmw_ldu_commit_list(struct vmw_private *dev_priv)
crtc = &entry->base.crtc;
w = max(w, crtc->x + crtc->mode.hdisplay);
h = max(h, crtc->y + crtc->mode.vdisplay);
- i++;
}
if (crtc = NULL)
return 0;
- fb = entry->base.crtc.primary->state->fb;
+ fb = crtc->primary->state->fb;
return vmw_kms_write_svga(dev_priv, w, h, fb->pitches[0],
fb->format->cpp[0] * 8,
--
2.27.0
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH] drm/vmwgfx: Use correct vmw_legacy_display_unit pointer
2020-06-26 10:34 [PATCH] drm/vmwgfx: Use correct vmw_legacy_display_unit pointer Dan Carpenter
@ 2020-07-14 1:16 ` Roland Scheidegger
0 siblings, 0 replies; 2+ messages in thread
From: Roland Scheidegger @ 2020-07-14 1:16 UTC (permalink / raw)
To: Dan Carpenter, VMware Graphics
Cc: David Airlie, Dave Airlie, kernel-janitors, dri-devel
Sorry for the delay, finally got time to look at this, seems all correct
to me, thanks. Applied to our vmvgfx-next tree. (I do wonder how this
somehow was supposed to work for all this time...)
Roland
Am 26.06.20 um 12:34 schrieb Dan Carpenter:
> The "entry" pointer is an offset from the list head and it doesn't
> point to a valid vmw_legacy_display_unit struct. Presumably the
> intent was to point to the last entry.
>
> Also the "i++" wasn't used so I have removed that as well.
>
> Fixes: d7e1958dbe4a ("drm/vmwgfx: Support older hardware.")
> Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
> ---
> From static analysis. Not tested. This bug celebrated its tenth
> birthday last month. :)
>
> drivers/gpu/drm/vmwgfx/vmwgfx_ldu.c | 5 ++---
> 1 file changed, 2 insertions(+), 3 deletions(-)
>
> diff --git a/drivers/gpu/drm/vmwgfx/vmwgfx_ldu.c b/drivers/gpu/drm/vmwgfx/vmwgfx_ldu.c
> index 16dafff5cab1..009f1742bed5 100644
> --- a/drivers/gpu/drm/vmwgfx/vmwgfx_ldu.c
> +++ b/drivers/gpu/drm/vmwgfx/vmwgfx_ldu.c
> @@ -81,7 +81,7 @@ static int vmw_ldu_commit_list(struct vmw_private *dev_priv)
> struct vmw_legacy_display_unit *entry;
> struct drm_framebuffer *fb = NULL;
> struct drm_crtc *crtc = NULL;
> - int i = 0;
> + int i;
>
> /* If there is no display topology the host just assumes
> * that the guest will set the same layout as the host.
> @@ -92,12 +92,11 @@ static int vmw_ldu_commit_list(struct vmw_private *dev_priv)
> crtc = &entry->base.crtc;
> w = max(w, crtc->x + crtc->mode.hdisplay);
> h = max(h, crtc->y + crtc->mode.vdisplay);
> - i++;
> }
>
> if (crtc = NULL)
> return 0;
> - fb = entry->base.crtc.primary->state->fb;
> + fb = crtc->primary->state->fb;
>
> return vmw_kms_write_svga(dev_priv, w, h, fb->pitches[0],
> fb->format->cpp[0] * 8,
>
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2020-07-14 1:16 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-06-26 10:34 [PATCH] drm/vmwgfx: Use correct vmw_legacy_display_unit pointer Dan Carpenter
2020-07-14 1:16 ` Roland Scheidegger
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).