From: Zhenyu Wang Date: Fri, 17 Oct 2008 05:15:48 +0000 (+0800) Subject: drm: Set cliprects to NULL when changing drawable to having 0 cliprects. X-Git-Tag: v2.6.28-rc1~28^2~10 X-Git-Url: http://pilppa.com/gitweb/?a=commitdiff_plain;h=863842736fb4571b22e0f7f4696bf13eeec57166;p=linux-2.6-omap-h63xx.git 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 Signed-off-by: Eric Anholt Signed-off-by: Dave Airlie --- diff --git a/drivers/gpu/drm/drm_drawable.c b/drivers/gpu/drm/drm_drawable.c index 1839c57663c..70b15d1b8f5 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