[PATCH] dix/resource: bug out if we get 0 type resource added

Dave Airlie airlied at gmail.com
Mon Dec 3 19:06:13 PST 2012


From: Dave Airlie <airlied at redhat.com>

With the missing RRProviderInit, we were adding 0 typed resources,
which crashed when xrestop hit them, we should warn before that happens
so future developers spot the problem.

Signed-off-by: Dave Airlie <airlied at redhat.com>
---
 dix/resource.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/dix/resource.c b/dix/resource.c
index 2aafa34..144fe23 100644
--- a/dix/resource.c
+++ b/dix/resource.c
@@ -793,6 +793,7 @@ AddResource(XID id, RESTYPE type, pointer value)
     ClientResourceRec *rrec;
     ResourcePtr res, *head;
 
+    BUG_RETURN_VAL_MSG(type == 0, FALSE, "Illegal to allocate resources with type 0\n");
 #ifdef XSERVER_DTRACE
     XSERVER_RESOURCE_ALLOC(id, type, value, TypeNameString(type));
 #endif
-- 
1.7.11.7



More information about the xorg-devel mailing list