From 863842736fb4571b22e0f7f4696bf13eeec57166 Mon Sep 17 00:00:00 2001 From: Zhenyu Wang Date: Fri, 17 Oct 2008 13:15:48 +0800 Subject: 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 --- drivers/gpu/drm/drm_drawable.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'drivers/gpu') diff --git a/drivers/gpu/drm/drm_drawable.c b/drivers/gpu/drm/drm_drawable.c index 1839c57663c5..70b15d1b8f54 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 -- cgit v1.2.1