All of lore.kernel.org
 help / color / mirror / Atom feed
From: Dan Carpenter via Ocfs2-devel <ocfs2-devel@oss.oracle.com>
To: David Laight <David.Laight@ACULAB.COM>
Cc: Linux Kernel Mailing List <linux-kernel@vger.kernel.org>,
	"Bos, H.J." <h.j.bos@vu.nl>,
	Brian Johannesmeyer <bjohannesmeyer@gmail.com>,
	Cristiano Giuffrida <c.giuffrida@vu.nl>,
	Geert Uytterhoeven <geert@linux-m68k.org>,
	Mike Rapoport <rppt@kernel.org>, Miguel Ojeda <ojeda@kernel.org>,
	Masahiro Yamada <masahiroy@kernel.org>,
	"ocfs2-devel@oss.oracle.com" <ocfs2-devel@oss.oracle.com>,
	Jakob Koschel <jakobkoschel@gmail.com>
Subject: Re: [Ocfs2-devel] [PATCH] ocfs2: fix check if list iterator did	find an element
Date: Mon, 21 Mar 2022 19:22:21 +0300	[thread overview]
Message-ID: <20220321162221.GQ336@kadam> (raw)
In-Reply-To: <75180dd18a3f460891cd93f7fcb3aa1c@AcuMS.aculab.com>

On Mon, Mar 21, 2022 at 04:00:10PM +0000, David Laight wrote:
> From: Dan Carpenter
> > Sent: 21 March 2022 13:55
> > On Mon, Mar 21, 2022 at 02:34:34PM +0100, Jakob Koschel wrote:
> > > >> @@ -556,11 +556,11 @@ static void *lockres_seq_start(struct seq_file *m, loff_t *pos)
> > > >> 		}
> > > >> 	}
> > > >>
> > > >> -	list_for_each_entry(res, track_list, tracking) {
> > > >> -		if (&res->tracking == &dlm->tracking_list)
> > > >> -			res = NULL;
> > > >> -		else
> > > >> -			dlm_lockres_get(res);
> > > >> +	list_for_each_entry(iter, track_list, tracking) {
> > > >> +		if (&iter->tracking != &dlm->tracking_list) {
> > 
> > This is an open coded version of:
> > 
> > 	if (!list_entry_is_head(iter, &dlm->tracking_list, tracking)) {
> 
> Doesn't list_for_each_entry() terminate before that happens?
> So this code is probably still horribly broken.

There is ! in the condition.  It's just a complicated way of writing
if (!0) { so code works fine, it's just messy.

regards,
dan carpenter


_______________________________________________
Ocfs2-devel mailing list
Ocfs2-devel@oss.oracle.com
https://oss.oracle.com/mailman/listinfo/ocfs2-devel

WARNING: multiple messages have this Message-ID (diff)
From: Dan Carpenter <dan.carpenter@oracle.com>
To: David Laight <David.Laight@ACULAB.COM>
Cc: Jakob Koschel <jakobkoschel@gmail.com>,
	Joseph Qi <joseph.qi@linux.alibaba.com>,
	Mark Fasheh <mark@fasheh.com>,
	Linux Kernel Mailing List <linux-kernel@vger.kernel.org>,
	"ocfs2-devel@oss.oracle.com" <ocfs2-devel@oss.oracle.com>,
	Joel Becker <jlbec@evilplan.org>,
	Andrew Morton <akpm@linux-foundation.org>,
	Geert Uytterhoeven <geert@linux-m68k.org>,
	Masahiro Yamada <masahiroy@kernel.org>,
	Miguel Ojeda <ojeda@kernel.org>, Mike Rapoport <rppt@kernel.org>,
	Brian Johannesmeyer <bjohannesmeyer@gmail.com>,
	Cristiano Giuffrida <c.giuffrida@vu.nl>,
	"Bos, H.J." <h.j.bos@vu.nl>
Subject: Re: [PATCH] ocfs2: fix check if list iterator did find an element
Date: Mon, 21 Mar 2022 19:22:21 +0300	[thread overview]
Message-ID: <20220321162221.GQ336@kadam> (raw)
In-Reply-To: <75180dd18a3f460891cd93f7fcb3aa1c@AcuMS.aculab.com>

On Mon, Mar 21, 2022 at 04:00:10PM +0000, David Laight wrote:
> From: Dan Carpenter
> > Sent: 21 March 2022 13:55
> > On Mon, Mar 21, 2022 at 02:34:34PM +0100, Jakob Koschel wrote:
> > > >> @@ -556,11 +556,11 @@ static void *lockres_seq_start(struct seq_file *m, loff_t *pos)
> > > >> 		}
> > > >> 	}
> > > >>
> > > >> -	list_for_each_entry(res, track_list, tracking) {
> > > >> -		if (&res->tracking == &dlm->tracking_list)
> > > >> -			res = NULL;
> > > >> -		else
> > > >> -			dlm_lockres_get(res);
> > > >> +	list_for_each_entry(iter, track_list, tracking) {
> > > >> +		if (&iter->tracking != &dlm->tracking_list) {
> > 
> > This is an open coded version of:
> > 
> > 	if (!list_entry_is_head(iter, &dlm->tracking_list, tracking)) {
> 
> Doesn't list_for_each_entry() terminate before that happens?
> So this code is probably still horribly broken.

There is ! in the condition.  It's just a complicated way of writing
if (!0) { so code works fine, it's just messy.

regards,
dan carpenter


  reply	other threads:[~2022-03-21 16:23 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-03-19 20:31 [PATCH] ocfs2: fix check if list iterator did find an element Jakob Koschel
2022-03-21  1:50 ` [Ocfs2-devel] " Joseph Qi via Ocfs2-devel
2022-03-21  1:50   ` Joseph Qi
2022-03-21 13:34   ` Jakob Koschel
2022-03-21 13:54     ` [Ocfs2-devel] " Dan Carpenter via Ocfs2-devel
2022-03-21 13:54       ` Dan Carpenter
2022-03-21 16:00       ` [Ocfs2-devel] " David Laight via Ocfs2-devel
2022-03-21 16:00         ` David Laight
2022-03-21 16:22         ` Dan Carpenter via Ocfs2-devel [this message]
2022-03-21 16:22           ` Dan Carpenter
2022-03-22  2:15     ` [Ocfs2-devel] " Joseph Qi via Ocfs2-devel
2022-03-22  2:15       ` Joseph Qi

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=20220321162221.GQ336@kadam \
    --to=ocfs2-devel@oss.oracle.com \
    --cc=David.Laight@ACULAB.COM \
    --cc=bjohannesmeyer@gmail.com \
    --cc=c.giuffrida@vu.nl \
    --cc=dan.carpenter@oracle.com \
    --cc=geert@linux-m68k.org \
    --cc=h.j.bos@vu.nl \
    --cc=jakobkoschel@gmail.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=masahiroy@kernel.org \
    --cc=ojeda@kernel.org \
    --cc=rppt@kernel.org \
    /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.