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

walter harms wharms at bfs.de
Tue Dec 4 10:00:43 PST 2012



Am 04.12.2012 06:23, schrieb Peter Hutterer:
> On Tue, Dec 04, 2012 at 01:06:13PM +1000, Dave Airlie wrote:
>> 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>
> 
> Reviewed-by: Peter Hutterer <peter.hutterer at who-t.net>
> 
> though you should probably check for type == RT_NONE, just for correctness.
> 
> Cheers,
>    Peter
> 

what is the expected behavier if a programm detects an unknown RESTYPE ?

re,
 wh

>> ---
>>  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