Re: [PATCH] Fix NULL pointer found by static analysis

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Wed, 23 Sep 2020, Chris Wilson <chris@xxxxxxxxxxxxxxxxxx> wrote:
> Quoting Steve Hampson (2020-09-23 05:40:54)
>> A static analysis tool has reveiled a NULL pointer error in
>> __i915_gem_object_lock.  This appears to be correct as many calls
>> pass a NULL into the ww parameter.
>> 
>> Signed-off-by: Steve Hampson <steven.t.hampson@xxxxxxxxx>
>> ---
>>  drivers/gpu/drm/i915/gem/i915_gem_object.h | 2 +-
>>  1 file changed, 1 insertion(+), 1 deletion(-)
>> 
>> diff --git a/drivers/gpu/drm/i915/gem/i915_gem_object.h b/drivers/gpu/drm/i915/gem/i915_gem_object.h
>> index d46db8d8f38e..9b18ead42991 100644
>> --- a/drivers/gpu/drm/i915/gem/i915_gem_object.h
>> +++ b/drivers/gpu/drm/i915/gem/i915_gem_object.h
>> @@ -126,7 +126,7 @@ static inline int __i915_gem_object_lock(struct drm_i915_gem_object *obj,
>>         if (ret == -EALREADY)
>>                 ret = 0;
>>  
>> -       if (ret == -EDEADLK)
>> +       if (ret == -EDEADLK && ww)
>
> EDEADLK is predicated by ww already.

The hard part is that neither the analyzer nor a human who doesn't know
how dma_resv_lock* work can easily deduce that. :(

BR,
Jani.


-- 
Jani Nikula, Intel Open Source Graphics Center
_______________________________________________
Intel-gfx mailing list
Intel-gfx@xxxxxxxxxxxxxxxxxxxxx
https://lists.freedesktop.org/mailman/listinfo/intel-gfx



[Index of Archives]     [AMD Graphics]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux