All of lore.kernel.org
 help / color / mirror / Atom feed
From: Dan Carpenter <dan.carpenter@oracle.com>
To: Matthew Auld <matthew.william.auld@gmail.com>
Cc: "Thomas Hellström" <thomas.hellstrom@linux.intel.com>,
	kbuild-all@lists.01.org, kbuild@lists.01.org,
	"ML dri-devel" <dri-devel@lists.freedesktop.org>,
	"Chris Wilson" <chris@chris-wilson.co.uk>,
	"Matthew Auld" <matthew.auld@intel.com>,
	"Intel Graphics Development" <intel-gfx@lists.freedesktop.org>
Subject: Re: [Intel-gfx] [drm-intel:drm-intel-gt-next 8/14] drivers/gpu/drm/i915/gt/selftest_migrate.c:102 copy() error: uninitialized symbol 'rq'.
Date: Fri, 2 Jul 2021 15:19:10 +0300	[thread overview]
Message-ID: <20210702121910.GX1983@kadam> (raw)
In-Reply-To: <CAM0jSHMyXEdS9wgkypKdvW1BNdUgcLxZR8Pd8nxSpPQHtiX+yA@mail.gmail.com>

On Fri, Jul 02, 2021 at 12:34:33PM +0100, Matthew Auld wrote:
> > > > cf586021642d80 Chris Wilson 2021-06-17   85             err = fn(migrate, &ww, src, dst, &rq);
> > > > cf586021642d80 Chris Wilson 2021-06-17   86             if (!err)
> > > > cf586021642d80 Chris Wilson 2021-06-17   87                     continue;
> > > >
> > > > Does fn() initialize "rq" on the success path?  Anyway Smatch would
> > > > complain anyway because it thinks the list could be empty or that we
> > > > might hit and early continue for everything.
> > >
> > > The fn() will always first initialize the rq to NULL. If it returns
> > > success then rq will always be a valid rq. If it returns an err then
> > > the rq might be NULL, or a valid rq depending on how far the copy/fn
> > > got.
> > >
> > > And for_i915_gem_ww() will always run at least once, since ww->loop =
> > > true, so this looks like a false positive?
> >
> > You don't think i915_gem_object_lock(), i915_gem_object_pin_map() or
> > i915_gem_object_pin_map() can fail?
> 
> Yeah, they can totally fail but then we mostly likely just hit the
> err_out. The for_i915_gem_ww() is a little strange since it's not
> really looping over anything, it's just about retrying the block if we
> see -EDEADLK(which involves dropping some locks), if we see any other
> error then the loop is terminated with ww->loop = false, which then
> hits the goto err_out.
> 

Ah, yeah, you're right.  False positive.

I hadn't looked at this code in context (I only had reviewed the email).
Now that I've pulled the tree and looked at the code, then I'm sort of
surprised that Smatch generates a warning...  I will investigate some
more.  Thanks!

regards,
dan carpenter


WARNING: multiple messages have this Message-ID (diff)
From: Dan Carpenter <dan.carpenter@oracle.com>
To: Matthew Auld <matthew.william.auld@gmail.com>
Cc: "Thomas Hellström" <thomas.hellstrom@linux.intel.com>,
	kbuild-all@lists.01.org, kbuild@lists.01.org,
	"ML dri-devel" <dri-devel@lists.freedesktop.org>,
	"Chris Wilson" <chris@chris-wilson.co.uk>,
	"Matthew Auld" <matthew.auld@intel.com>,
	"Intel Graphics Development" <intel-gfx@lists.freedesktop.org>
Subject: Re: [Intel-gfx] [drm-intel:drm-intel-gt-next 8/14] drivers/gpu/drm/i915/gt/selftest_migrate.c:102 copy() error: uninitialized symbol 'rq'.
Date: Fri, 2 Jul 2021 15:19:10 +0300	[thread overview]
Message-ID: <20210702121910.GX1983@kadam> (raw)
In-Reply-To: <CAM0jSHMyXEdS9wgkypKdvW1BNdUgcLxZR8Pd8nxSpPQHtiX+yA@mail.gmail.com>

On Fri, Jul 02, 2021 at 12:34:33PM +0100, Matthew Auld wrote:
> > > > cf586021642d80 Chris Wilson 2021-06-17   85             err = fn(migrate, &ww, src, dst, &rq);
> > > > cf586021642d80 Chris Wilson 2021-06-17   86             if (!err)
> > > > cf586021642d80 Chris Wilson 2021-06-17   87                     continue;
> > > >
> > > > Does fn() initialize "rq" on the success path?  Anyway Smatch would
> > > > complain anyway because it thinks the list could be empty or that we
> > > > might hit and early continue for everything.
> > >
> > > The fn() will always first initialize the rq to NULL. If it returns
> > > success then rq will always be a valid rq. If it returns an err then
> > > the rq might be NULL, or a valid rq depending on how far the copy/fn
> > > got.
> > >
> > > And for_i915_gem_ww() will always run at least once, since ww->loop =
> > > true, so this looks like a false positive?
> >
> > You don't think i915_gem_object_lock(), i915_gem_object_pin_map() or
> > i915_gem_object_pin_map() can fail?
> 
> Yeah, they can totally fail but then we mostly likely just hit the
> err_out. The for_i915_gem_ww() is a little strange since it's not
> really looping over anything, it's just about retrying the block if we
> see -EDEADLK(which involves dropping some locks), if we see any other
> error then the loop is terminated with ww->loop = false, which then
> hits the goto err_out.
> 

Ah, yeah, you're right.  False positive.

I hadn't looked at this code in context (I only had reviewed the email).
Now that I've pulled the tree and looked at the code, then I'm sort of
surprised that Smatch generates a warning...  I will investigate some
more.  Thanks!

regards,
dan carpenter

_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

WARNING: multiple messages have this Message-ID (diff)
From: Dan Carpenter <dan.carpenter@oracle.com>
To: kbuild@lists.01.org
Subject: Re: [Intel-gfx] [drm-intel:drm-intel-gt-next 8/14] drivers/gpu/drm/i915/gt/selftest_migrate.c:102 copy() error: uninitialized symbol 'rq'.
Date: Fri, 02 Jul 2021 15:19:10 +0300	[thread overview]
Message-ID: <20210702121910.GX1983@kadam> (raw)
In-Reply-To: <CAM0jSHMyXEdS9wgkypKdvW1BNdUgcLxZR8Pd8nxSpPQHtiX+yA@mail.gmail.com>

[-- Attachment #1: Type: text/plain, Size: 1740 bytes --]

On Fri, Jul 02, 2021 at 12:34:33PM +0100, Matthew Auld wrote:
> > > > cf586021642d80 Chris Wilson 2021-06-17   85             err = fn(migrate, &ww, src, dst, &rq);
> > > > cf586021642d80 Chris Wilson 2021-06-17   86             if (!err)
> > > > cf586021642d80 Chris Wilson 2021-06-17   87                     continue;
> > > >
> > > > Does fn() initialize "rq" on the success path?  Anyway Smatch would
> > > > complain anyway because it thinks the list could be empty or that we
> > > > might hit and early continue for everything.
> > >
> > > The fn() will always first initialize the rq to NULL. If it returns
> > > success then rq will always be a valid rq. If it returns an err then
> > > the rq might be NULL, or a valid rq depending on how far the copy/fn
> > > got.
> > >
> > > And for_i915_gem_ww() will always run at least once, since ww->loop =
> > > true, so this looks like a false positive?
> >
> > You don't think i915_gem_object_lock(), i915_gem_object_pin_map() or
> > i915_gem_object_pin_map() can fail?
> 
> Yeah, they can totally fail but then we mostly likely just hit the
> err_out. The for_i915_gem_ww() is a little strange since it's not
> really looping over anything, it's just about retrying the block if we
> see -EDEADLK(which involves dropping some locks), if we see any other
> error then the loop is terminated with ww->loop = false, which then
> hits the goto err_out.
> 

Ah, yeah, you're right.  False positive.

I hadn't looked at this code in context (I only had reviewed the email).
Now that I've pulled the tree and looked at the code, then I'm sort of
surprised that Smatch generates a warning...  I will investigate some
more.  Thanks!

regards,
dan carpenter

WARNING: multiple messages have this Message-ID (diff)
From: Dan Carpenter <dan.carpenter@oracle.com>
To: kbuild-all@lists.01.org
Subject: Re: [Intel-gfx] [drm-intel:drm-intel-gt-next 8/14] drivers/gpu/drm/i915/gt/selftest_migrate.c:102 copy() error: uninitialized symbol 'rq'.
Date: Fri, 02 Jul 2021 15:19:10 +0300	[thread overview]
Message-ID: <20210702121910.GX1983@kadam> (raw)
In-Reply-To: <CAM0jSHMyXEdS9wgkypKdvW1BNdUgcLxZR8Pd8nxSpPQHtiX+yA@mail.gmail.com>

[-- Attachment #1: Type: text/plain, Size: 1740 bytes --]

On Fri, Jul 02, 2021 at 12:34:33PM +0100, Matthew Auld wrote:
> > > > cf586021642d80 Chris Wilson 2021-06-17   85             err = fn(migrate, &ww, src, dst, &rq);
> > > > cf586021642d80 Chris Wilson 2021-06-17   86             if (!err)
> > > > cf586021642d80 Chris Wilson 2021-06-17   87                     continue;
> > > >
> > > > Does fn() initialize "rq" on the success path?  Anyway Smatch would
> > > > complain anyway because it thinks the list could be empty or that we
> > > > might hit and early continue for everything.
> > >
> > > The fn() will always first initialize the rq to NULL. If it returns
> > > success then rq will always be a valid rq. If it returns an err then
> > > the rq might be NULL, or a valid rq depending on how far the copy/fn
> > > got.
> > >
> > > And for_i915_gem_ww() will always run at least once, since ww->loop =
> > > true, so this looks like a false positive?
> >
> > You don't think i915_gem_object_lock(), i915_gem_object_pin_map() or
> > i915_gem_object_pin_map() can fail?
> 
> Yeah, they can totally fail but then we mostly likely just hit the
> err_out. The for_i915_gem_ww() is a little strange since it's not
> really looping over anything, it's just about retrying the block if we
> see -EDEADLK(which involves dropping some locks), if we see any other
> error then the loop is terminated with ww->loop = false, which then
> hits the goto err_out.
> 

Ah, yeah, you're right.  False positive.

I hadn't looked at this code in context (I only had reviewed the email).
Now that I've pulled the tree and looked at the code, then I'm sort of
surprised that Smatch generates a warning...  I will investigate some
more.  Thanks!

regards,
dan carpenter

  reply	other threads:[~2021-07-02 12:19 UTC|newest]

Thread overview: 25+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-07-01 23:14 [drm-intel:drm-intel-gt-next 8/14] drivers/gpu/drm/i915/gt/selftest_migrate.c:102 copy() error: uninitialized symbol 'rq' kernel test robot
2021-07-02  8:44 ` Dan Carpenter
2021-07-02  8:44 ` [Intel-gfx] " Dan Carpenter
2021-07-02  8:44 ` Dan Carpenter
2021-07-02 10:32 ` [Intel-gfx] " Matthew Auld
2021-07-02 10:32   ` Matthew Auld
2021-07-02 10:32   ` Matthew Auld
2021-07-02 11:07   ` Dan Carpenter
2021-07-02 11:07     ` Dan Carpenter
2021-07-02 11:07     ` Dan Carpenter
2021-07-02 11:07     ` Dan Carpenter
2021-07-02 11:13     ` Dan Carpenter
2021-07-02 11:13       ` Dan Carpenter
2021-07-02 11:13       ` Dan Carpenter
2021-07-02 11:13       ` Dan Carpenter
2021-07-02 11:57       ` Matthew Auld
2021-07-02 11:57         ` Matthew Auld
2021-07-02 11:57         ` Matthew Auld
2021-07-02 11:34     ` Matthew Auld
2021-07-02 11:34       ` Matthew Auld
2021-07-02 11:34       ` Matthew Auld
2021-07-02 12:19       ` Dan Carpenter [this message]
2021-07-02 12:19         ` Dan Carpenter
2021-07-02 12:19         ` Dan Carpenter
2021-07-02 12:19         ` Dan Carpenter

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=20210702121910.GX1983@kadam \
    --to=dan.carpenter@oracle.com \
    --cc=chris@chris-wilson.co.uk \
    --cc=dri-devel@lists.freedesktop.org \
    --cc=intel-gfx@lists.freedesktop.org \
    --cc=kbuild-all@lists.01.org \
    --cc=kbuild@lists.01.org \
    --cc=matthew.auld@intel.com \
    --cc=matthew.william.auld@gmail.com \
    --cc=thomas.hellstrom@linux.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.