From: Dan Carpenter <dan.carpenter@oracle•com>
To: Jakob Koschel <jakobkoschel@gmail•com>
Cc: Linus Torvalds <torvalds@linux-foundation•org>,
linux-arch <linux-arch@vger•kernel.org>,
Thomas Gleixner <tglx@linutronix•de>,
Arnd Bergman <arnd@arndb•de>,
Andy Shevchenko <andriy.shevchenko@linux•intel.com>,
Andrew Morton <akpm@linux-foundation•org>,
Kees Cook <keescook@chromium•org>,
Mike Rapoport <rppt@kernel•org>,
"Gustavo A. R. Silva" <gustavo@embeddedor•com>,
Brian Johannesmeyer <bjohannesmeyer@gmail•com>,
Cristiano Giuffrida <c.giuffrida@vu•nl>,
"Bos, H.J." <h.j.bos@vu•nl>,
Christophe JAILLET <christophe.jaillet@wanadoo•fr>,
Jason Gunthorpe <jgg@ziepe•ca>,
Rasmus Villemoes <linux@rasmusvillemoes•dk>,
Nathan Chancellor <nathan@kernel•org>,
linux-arm-kernel@lists•infradead.org,
linux-kernel@vger•kernel.org, linuxppc-dev@lists•ozlabs.org,
linux-sgx@vger•kernel.org, drbd-dev@lists•linbit.com,
linux-block@vger•kernel.org, linux-iio@vger•kernel.org,
linux-crypto@vger•kernel.org, dmaengine@vger•kernel.org,
linux1394-devel@lists•sourceforge.net,
amd-gfx@lists•freedesktop.org, dri-devel@lists•freedesktop.org,
intel-gfx@lists•freedesktop.org, nouveau@lists•freedesktop.org,
linux-rdma@vger•kernel.org, linux-media@vger•kernel.org,
intel-wired-lan@lists•osuosl.org, netdev@vger•kernel.org,
linux-wireless@vger•kernel.org, linux-pm@vger•kernel.org,
linux-scsi@vger•kernel.org, linux-staging@lists•linux.dev,
linux-usb@vger•kernel.org, linux-aspeed@lists•ozlabs.org,
bcm-kernel-feedback-list@broadcom•com,
linux-tegra@vger•kernel.org, linux-mediatek@lists•infradead.org,
kvm@vger•kernel.org, linux-cifs@vger•kernel.org,
samba-technical@lists•samba.org,
linux-f2fs-devel@lists•sourceforge.net,
linux-fsdevel@vger•kernel.org,
kgdb-bugreport@lists•sourceforge.net,
v9fs-developer@lists•sourceforge.net,
tipc-discussion@lists•sourceforge.net,
alsa-devel@alsa-project•org
Subject: Re: [PATCH 6/6] treewide: remove check of list iterator against head past the loop body
Date: Mon, 28 Feb 2022 16:12:55 +0300 [thread overview]
Message-ID: <20220228131255.GC2812@kadam> (raw)
In-Reply-To: <20220228110822.491923-7-jakobkoschel@gmail.com>
On Mon, Feb 28, 2022 at 12:08:22PM +0100, Jakob Koschel wrote:
> diff --git a/drivers/infiniband/hw/hfi1/tid_rdma.c b/drivers/infiniband/hw/hfi1/tid_rdma.c
> index 2a7abf7a1f7f..a069847b56aa 100644
> --- a/drivers/infiniband/hw/hfi1/tid_rdma.c
> +++ b/drivers/infiniband/hw/hfi1/tid_rdma.c
> @@ -1239,7 +1239,7 @@ static int kern_alloc_tids(struct tid_rdma_flow *flow)
> struct hfi1_ctxtdata *rcd = flow->req->rcd;
> struct hfi1_devdata *dd = rcd->dd;
> u32 ngroups, pageidx = 0;
> - struct tid_group *group = NULL, *used;
> + struct tid_group *group = NULL, *used, *tmp;
> u8 use;
>
> flow->tnode_cnt = 0;
> @@ -1248,13 +1248,15 @@ static int kern_alloc_tids(struct tid_rdma_flow *flow)
> goto used_list;
>
> /* First look at complete groups */
> - list_for_each_entry(group, &rcd->tid_group_list.list, list) {
> - kern_add_tid_node(flow, rcd, "complete groups", group,
> - group->size);
> + list_for_each_entry(tmp, &rcd->tid_group_list.list, list) {
> + kern_add_tid_node(flow, rcd, "complete groups", tmp,
> + tmp->size);
>
> - pageidx += group->size;
> - if (!--ngroups)
> + pageidx += tmp->size;
> + if (!--ngroups) {
> + group = tmp;
> break;
> + }
> }
>
> if (pageidx >= flow->npagesets)
> @@ -1277,7 +1279,7 @@ static int kern_alloc_tids(struct tid_rdma_flow *flow)
> * However, if we are at the head, we have reached the end of the
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
> * complete groups list from the first loop above
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
> */
Originally this code tested for an open code list_is_head() so the
comment made sense, but it's out of date now. Just delete it.
> - if (group && &group->list == &rcd->tid_group_list.list)
> + if (!group)
> goto bail_eagain;
> group = list_prepare_entry(group, &rcd->tid_group_list.list,
> list);
regards,
dan carpenter
next prev parent reply other threads:[~2022-02-28 13:15 UTC|newest]
Thread overview: 85+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-02-28 11:08 [PATCH 0/6] Remove usage of list iterator past the loop body Jakob Koschel
2022-02-28 11:08 ` [PATCH 1/6] drivers: usb: remove " Jakob Koschel
2022-02-28 11:24 ` Dan Carpenter
2022-02-28 12:03 ` Jakob Koschel
2022-02-28 13:18 ` Dan Carpenter
2022-02-28 18:20 ` Joe Perches
2022-03-01 5:52 ` Dan Carpenter
2022-02-28 11:08 ` [PATCH 2/6] treewide: remove using list iterator after loop body as a ptr Jakob Koschel
2022-02-28 11:20 ` Greg KH
2022-02-28 12:06 ` Jakob Koschel
2022-03-01 17:37 ` Greg KH
2022-02-28 12:19 ` Christian König
2022-02-28 19:56 ` Linus Torvalds
2022-02-28 20:03 ` Linus Torvalds
2022-02-28 20:10 ` Linus Torvalds
2022-02-28 20:14 ` Linus Torvalds
2022-02-28 20:53 ` Segher Boessenkool
2022-02-28 20:16 ` Matthew Wilcox
2022-02-28 20:27 ` Johannes Berg
2022-02-28 20:41 ` Linus Torvalds
2022-02-28 20:37 ` Linus Torvalds
2022-02-28 23:26 ` Matthew Wilcox
2022-03-01 0:45 ` Linus Torvalds
2022-03-01 0:57 ` Linus Torvalds
2022-03-01 18:14 ` Kees Cook
2022-03-01 18:47 ` Linus Torvalds
2022-03-01 19:01 ` Matthew Wilcox
2022-03-01 3:03 ` David Laight
2022-02-28 21:47 ` Jakob Koschel
2022-03-01 0:41 ` Linus Torvalds
2022-03-01 6:32 ` Jakub Kicinski
2022-03-01 11:28 ` Jakob Koschel
2022-03-01 17:36 ` Greg KH
2022-03-01 17:40 ` Jakob Koschel
2022-03-01 17:58 ` Greg KH
2022-03-01 18:21 ` Kees Cook
2022-03-02 9:31 ` Xiaomeng Tong
2022-03-02 14:04 ` David Laight
2022-03-03 2:27 ` Xiaomeng Tong
2022-03-03 4:58 ` David Laight
2022-03-03 7:26 ` Xiaomeng Tong
2022-03-03 9:30 ` David Laight
2022-03-03 12:37 ` Xiaomeng Tong
2022-03-03 12:18 ` [Kgdb-bugreport] " Daniel Thompson
2022-03-04 6:59 ` Xiaomeng Tong
2022-03-03 7:32 ` Jakob Koschel
2022-03-03 8:30 ` Xiaomeng Tong
2022-03-03 8:38 ` Xiaomeng Tong
2022-02-28 20:07 ` Christian König
2022-02-28 20:42 ` James Bottomley
2022-02-28 20:56 ` Christian König
2022-02-28 21:13 ` James Bottomley
2022-03-01 7:03 ` Christian König
2022-02-28 22:05 ` Jakob Koschel
2022-02-28 21:18 ` Jeffrey Walton
2022-02-28 21:59 ` Mike Rapoport
2022-02-28 22:28 ` James Bottomley
2022-02-28 22:50 ` Barnabás Pőcze
2022-03-01 0:30 ` Segher Boessenkool
2022-03-01 0:54 ` Linus Torvalds
2022-03-01 19:06 ` Linus Torvalds
2022-03-01 19:42 ` Linus Torvalds
2022-03-01 22:58 ` David Laight
2022-03-01 23:03 ` Linus Torvalds
2022-03-01 23:19 ` David Laight
2022-03-01 23:55 ` Linus Torvalds
2022-03-02 9:29 ` Rasmus Villemoes
2022-03-02 20:07 ` Kees Cook
2022-03-02 20:18 ` Linus Torvalds
2022-03-02 20:59 ` Kees Cook
2022-03-03 8:37 ` Dan Carpenter
2022-03-03 10:56 ` Dan Carpenter
2022-03-01 2:15 ` David Laight
2022-02-28 13:13 ` Dan Carpenter
2022-02-28 11:08 ` [PATCH 3/6] treewide: fix incorrect use to determine if list is empty Jakob Koschel
2022-02-28 11:38 ` Dan Carpenter
2022-02-28 11:08 ` [PATCH 4/6] drivers: remove unnecessary use of list iterator variable Jakob Koschel
2022-02-28 11:08 ` [PATCH 5/6] treewide: remove dereference of list iterator after loop body Jakob Koschel
2022-02-28 11:08 ` [PATCH 6/6] treewide: remove check of list iterator against head past the " Jakob Koschel
2022-02-28 13:12 ` Dan Carpenter [this message]
2022-03-01 20:36 ` Linus Torvalds
2022-03-02 17:14 ` [Intel-gfx] " Tvrtko Ursulin
2022-03-07 15:00 ` [PATCH 0/6] Remove usage of list iterator " Dan Carpenter
2022-03-07 15:26 ` David Laight
2022-03-07 19:15 ` Linus Torvalds
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=20220228131255.GC2812@kadam \
--to=dan.carpenter@oracle$(echo .)com \
--cc=akpm@linux-foundation$(echo .)org \
--cc=alsa-devel@alsa-project$(echo .)org \
--cc=amd-gfx@lists$(echo .)freedesktop.org \
--cc=andriy.shevchenko@linux$(echo .)intel.com \
--cc=arnd@arndb$(echo .)de \
--cc=bcm-kernel-feedback-list@broadcom$(echo .)com \
--cc=bjohannesmeyer@gmail$(echo .)com \
--cc=c.giuffrida@vu$(echo .)nl \
--cc=christophe.jaillet@wanadoo$(echo .)fr \
--cc=dmaengine@vger$(echo .)kernel.org \
--cc=drbd-dev@lists$(echo .)linbit.com \
--cc=dri-devel@lists$(echo .)freedesktop.org \
--cc=gustavo@embeddedor$(echo .)com \
--cc=h.j.bos@vu$(echo .)nl \
--cc=intel-gfx@lists$(echo .)freedesktop.org \
--cc=intel-wired-lan@lists$(echo .)osuosl.org \
--cc=jakobkoschel@gmail$(echo .)com \
--cc=jgg@ziepe$(echo .)ca \
--cc=keescook@chromium$(echo .)org \
--cc=kgdb-bugreport@lists$(echo .)sourceforge.net \
--cc=kvm@vger$(echo .)kernel.org \
--cc=linux-arch@vger$(echo .)kernel.org \
--cc=linux-arm-kernel@lists$(echo .)infradead.org \
--cc=linux-aspeed@lists$(echo .)ozlabs.org \
--cc=linux-block@vger$(echo .)kernel.org \
--cc=linux-cifs@vger$(echo .)kernel.org \
--cc=linux-crypto@vger$(echo .)kernel.org \
--cc=linux-f2fs-devel@lists$(echo .)sourceforge.net \
--cc=linux-fsdevel@vger$(echo .)kernel.org \
--cc=linux-iio@vger$(echo .)kernel.org \
--cc=linux-kernel@vger$(echo .)kernel.org \
--cc=linux-media@vger$(echo .)kernel.org \
--cc=linux-mediatek@lists$(echo .)infradead.org \
--cc=linux-pm@vger$(echo .)kernel.org \
--cc=linux-rdma@vger$(echo .)kernel.org \
--cc=linux-scsi@vger$(echo .)kernel.org \
--cc=linux-sgx@vger$(echo .)kernel.org \
--cc=linux-staging@lists$(echo .)linux.dev \
--cc=linux-tegra@vger$(echo .)kernel.org \
--cc=linux-usb@vger$(echo .)kernel.org \
--cc=linux-wireless@vger$(echo .)kernel.org \
--cc=linux1394-devel@lists$(echo .)sourceforge.net \
--cc=linux@rasmusvillemoes$(echo .)dk \
--cc=linuxppc-dev@lists$(echo .)ozlabs.org \
--cc=nathan@kernel$(echo .)org \
--cc=netdev@vger$(echo .)kernel.org \
--cc=nouveau@lists$(echo .)freedesktop.org \
--cc=rppt@kernel$(echo .)org \
--cc=samba-technical@lists$(echo .)samba.org \
--cc=tglx@linutronix$(echo .)de \
--cc=tipc-discussion@lists$(echo .)sourceforge.net \
--cc=torvalds@linux-foundation$(echo .)org \
--cc=v9fs-developer@lists$(echo .)sourceforge.net \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
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