Intel-GFX Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: Jani Nikula <jani.nikula@linux.intel.com>
To: Chris Wilson <chris@chris-wilson.co.uk>,
	Steve Hampson <steven.t.hampson@intel.com>,
	intel-gfx@lists.freedesktop.org
Subject: Re: [Intel-gfx] [PATCH] Fix NULL pointer found by static analysis
Date: Wed, 23 Sep 2020 12:04:58 +0300	[thread overview]
Message-ID: <87eemsrhhh.fsf@intel.com> (raw)
In-Reply-To: <160085149249.27151.12750028761264321987@build.alporthouse.com>

On Wed, 23 Sep 2020, Chris Wilson <chris@chris-wilson.co.uk> 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@intel.com>
>> ---
>>  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@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

  reply	other threads:[~2020-09-23  9:05 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-09-23  4:40 [Intel-gfx] [PATCH] Fix NULL pointer found by static analysis Steve Hampson
2020-09-23  5:28 ` [Intel-gfx] ✓ Fi.CI.BAT: success for " Patchwork
2020-09-23  8:48 ` [Intel-gfx] ✓ Fi.CI.IGT: " Patchwork
2020-09-23  8:58 ` [Intel-gfx] [PATCH] " Chris Wilson
2020-09-23  9:04   ` Jani Nikula [this message]
2020-09-23 21:23 ` Hampson, Steven T
2020-09-23 21:57 ` [Intel-gfx] ✗ Fi.CI.CHECKPATCH: warning for Fix NULL pointer found by static analysis (rev2) Patchwork
2020-09-23 22:22 ` [Intel-gfx] ✓ Fi.CI.BAT: success " Patchwork
2020-09-24  1:08 ` [Intel-gfx] ✗ Fi.CI.IGT: failure " Patchwork

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=87eemsrhhh.fsf@intel.com \
    --to=jani.nikula@linux.intel.com \
    --cc=chris@chris-wilson.co.uk \
    --cc=intel-gfx@lists.freedesktop.org \
    --cc=steven.t.hampson@intel.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox