From: Jakob Koschel <jkl820.git@gmail.com>
To: Ben Skeggs <bskeggs@redhat.com>,
Karol Herbst <kherbst@redhat.com>, Lyude Paul <lyude@redhat.com>,
David Airlie <airlied@gmail.com>, Daniel Vetter <daniel@ffwll.ch>
Cc: dri-devel@lists.freedesktop.org, nouveau@lists.freedesktop.org,
linux-kernel@vger.kernel.org,
Pietro Borrello <borrello@diag.uniroma1.it>,
Cristiano Giuffrida <c.giuffrida@vu.nl>,
"Bos, H.J." <h.j.bos@vu.nl>, Jakob Koschel <jkl820.git@gmail.com>
Subject: [PATCH 0/2] drm/nouveau: avoid usage of list iterator after loop
Date: Wed, 01 Mar 2023 18:25:36 +0100 [thread overview]
Message-ID: <20230301-drm-nouveau-avoid-iter-after-loop-v1-0-0702ec23f970@gmail.com> (raw)
This patch set includes two instances where the list iterator variable
'pstate' is implicitly assumed to be valid after the iterator loop.
While in pratice that is most likely the case (if
'pstatei'/'args->v0.state' is <= the elements in clk->states), we should
explicitly only allow 'pstate' to always point to correct 'nvkm_pstate'
structs.
That allows catching potential bugs with BUG_ON(!pstate) that otherwise
would be completely undetectable.
It also helps the greater mission to hopefully move the list iterator
variable into the iterating macro directly [1].
Link: https://lore.kernel.org/all/CAHk-=wgRr_D8CB-D9Kg-c=EHreAsk5SqXPwr9Y7k9sA6cWXJ6w@mail.gmail.com/ [1]
Signed-off-by: Jakob Koschel <jkl820.git@gmail.com>
---
Jakob Koschel (2):
drm/nouveau/device: avoid usage of list iterator after loop
drm/nouveau/clk: avoid usage of list iterator after loop
drivers/gpu/drm/nouveau/nvkm/engine/device/ctrl.c | 9 ++++++---
drivers/gpu/drm/nouveau/nvkm/subdev/clk/base.c | 9 ++++++---
2 files changed, 12 insertions(+), 6 deletions(-)
---
base-commit: c0927a7a5391f7d8e593e5e50ead7505a23cadf9
change-id: 20230301-drm-nouveau-avoid-iter-after-loop-4bff97166efa
Best regards,
--
Jakob Koschel <jkl820.git@gmail.com>
next reply other threads:[~2023-03-01 17:25 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-03-01 17:25 Jakob Koschel [this message]
2023-03-01 17:25 ` [PATCH 1/2] drm/nouveau/device: " Jakob Koschel
2023-03-07 22:49 ` Lyude Paul
2023-03-01 17:25 ` [PATCH 2/2] drm/nouveau/clk: " Jakob Koschel
2023-03-07 22:50 ` Lyude Paul
2023-03-07 22:43 ` [PATCH 0/2] drm/nouveau: " Lyude Paul
2023-03-07 22:46 ` Lyude Paul
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=20230301-drm-nouveau-avoid-iter-after-loop-v1-0-0702ec23f970@gmail.com \
--to=jkl820.git@gmail.com \
--cc=airlied@gmail.com \
--cc=borrello@diag.uniroma1.it \
--cc=bskeggs@redhat.com \
--cc=c.giuffrida@vu.nl \
--cc=daniel@ffwll.ch \
--cc=dri-devel@lists.freedesktop.org \
--cc=h.j.bos@vu.nl \
--cc=kherbst@redhat.com \
--cc=linux-kernel@vger.kernel.org \
--cc=lyude@redhat.com \
--cc=nouveau@lists.freedesktop.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®