Skip to content

Commit

Permalink
drm: Set cliprects to NULL when changing drawable to having 0 cliprects.
Browse files Browse the repository at this point in the history
This avoids setting the cliprects pointer to a zero-sized allocation.

Signed-off-by: Zhenyu Wang <zhenyu.z.wang@intel.com>
Signed-off-by: Eric Anholt <eric@anholt.net>
Signed-off-by: Dave Airlie <airlied@redhat.com>
  • Loading branch information
Zhenyu Wang authored and Dave Airlie committed Oct 23, 2008
1 parent e9d21d7 commit 8638427
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion drivers/gpu/drm/drm_drawable.c
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 8638427

Please sign in to comment.