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: firefly_0821_release~17136^2~10 X-Git-Url: http://demsky.eecs.uci.edu/git/?a=commitdiff_plain;h=863842736fb4571b22e0f7f4696bf13eeec57166;p=firefly-linux-kernel-4.4.55.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 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