On Fri, 2008-10-17 at 13:15 +0800, Zhenyu Wang wrote: > From 09a461ca6d05b0c6e82aeca158bad6549ba84904 Mon Sep 17 00:00:00 2001 > From: Zhenyu Wang <[EMAIL PROTECTED]> > Date: Fri, 17 Oct 2008 11:20:14 +0800 > Subject: [PATCH] drm: fix stalled cliprects when update drawable info with > zero rects. > > When passed in drawable's cliprect number as zero, we may > still alloc and leave a stalled cliprects. Fix by clean up > cliprects in that case. > > Signed-off-by: Zhenyu Wang <[EMAIL PROTECTED]> > --- > drivers/gpu/drm/drm_drawable.c | 4 +++- > 1 files changed, 3 insertions(+), 1 deletions(-) > > diff --git a/drivers/gpu/drm/drm_drawable.c b/drivers/gpu/drm/drm_drawable.c > index 1839c57..70b15d1 100644 > --- a/drivers/gpu/drm/drm_drawable.c > +++ b/drivers/gpu/drm/drm_drawable.c > @@ -111,7 +111,9 @@ int drm_update_drawable_info(struct drm_device *dev, void > *data, struct drm_file > > switch (update->type) { > case DRM_DRAWABLE_CLIPRECTS: > - if (update->num != info->num_rects) { > + if (update->num == 0) > + rects = NULL; > + else if (update->num != info->num_rects) { > rects = drm_alloc(update->num * sizeof(struct > drm_clip_rect), > DRM_MEM_BUFS); > } else
Well, if I'm reading things right, when you pass zero cliprects, you'd get either previously != 0: drm_alloc(0, DRM_MEM_BUFS) = ZERO_SIZE_PTR; previously == 0: whatever the previous value was (NULL or ZERO_SIZE_PTR) However, given that I earlier today wrote a fix that tried to use info->rects != NULL instead of info->num_rects != 0 before dereferening the first rect, this seems like a sensible change to me. Pushed to drm-intel-next with a change of the commit message: commit 8b4daf046d90f1b60c53f14ef89b6fd6d8b35f30 Author: Zhenyu Wang <[EMAIL PROTECTED]> Date: Fri Oct 17 13:15:48 2008 +0800 drm: Set cliprects to NULL when changing drawable to having 0 cliprects. This avoids setting the cliprects pointer to a zero-sized allocation. Signed-off-by: Zhenyu Wang <[EMAIL PROTECTED]> Signed-off-by: Eric Anholt <[EMAIL PROTECTED]> -- Eric Anholt [EMAIL PROTECTED] [EMAIL PROTECTED]
signature.asc
Description: This is a digitally signed message part
------------------------------------------------------------------------- This SF.Net email is sponsored by the Moblin Your Move Developer's challenge Build the coolest Linux based applications with Moblin SDK & win great prizes Grand prize is a trip for two to an Open Source event anywhere in the world http://moblin-contest.org/redirect.php?banner_id=100&url=/
-- _______________________________________________ Dri-devel mailing list Dri-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/dri-devel