[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20220321162221.GQ336@kadam>
Date: Mon, 21 Mar 2022 19:22:21 +0300
From: Dan Carpenter <dan.carpenter@...cle.com>
To: David Laight <David.Laight@...LAB.COM>
Cc: Jakob Koschel <jakobkoschel@...il.com>,
Joseph Qi <joseph.qi@...ux.alibaba.com>,
Mark Fasheh <mark@...heh.com>,
Linux Kernel Mailing List <linux-kernel@...r.kernel.org>,
"ocfs2-devel@....oracle.com" <ocfs2-devel@....oracle.com>,
Joel Becker <jlbec@...lplan.org>,
Andrew Morton <akpm@...ux-foundation.org>,
Geert Uytterhoeven <geert@...ux-m68k.org>,
Masahiro Yamada <masahiroy@...nel.org>,
Miguel Ojeda <ojeda@...nel.org>,
Mike Rapoport <rppt@...nel.org>,
Brian Johannesmeyer <bjohannesmeyer@...il.com>,
Cristiano Giuffrida <c.giuffrida@...nl>,
"Bos, H.J." <h.j.bos@...nl>
Subject: Re: [PATCH] ocfs2: fix check if list iterator did find an element
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
Powered by blists - more mailing lists