From 78970676e79d462cf99509012db54479ba93c01a Mon Sep 17 00:00:00 2001 From: Chris Wilson Date: Tue, 11 Mar 2014 07:33:09 +0000 Subject: [PATCH] sna: Be defensive when applying size restrictions to bo The assumption that all paths prevalidate the restrictions upon creation the bo are false. Some important paths try to force the bo creation in order to meet client expectations (e.g. DRI). So we are faced with impossible requests which must fail, so make sure we do report those failures. Bugzilla: https://bugs.launchpad.net/ubuntu/+source/xserver-xorg-video-intel/+bug/1289049 Signed-off-by: Chris Wilson --- src/sna/kgem.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/sna/kgem.c b/src/sna/kgem.c index 698e251..8aef623 100644 --- a/src/sna/kgem.c +++ b/src/sna/kgem.c @@ -4196,7 +4196,9 @@ struct kgem_bo *kgem_create_2d(struct kgem *kgem, size = kgem_surface_size(kgem, kgem->has_relaxed_fencing, flags, width, height, bpp, tiling, &pitch); - assert(size && size <= kgem->max_object_size); + if (size == 0) + return NULL; + size /= PAGE_SIZE; bucket = cache_bucket(size); -- 2.7.4