Re: [PATCH] staging: greybus: audio: do not use iterator after list loop
From: Johan Hovold
Date: Wed Oct 07 2026 - 07:57:30 EST
On Wed, Oct 07, 2026 at 02:41:04PM +0530, Rahul Rao wrote:
> Using the list iterator variable outside the loop breaks iterator scope
> semantics and can result in invalid memory access if the loop completes
> without finding a match.
No, it cannot. I rejected another patch like this earlier this week:
https://lore.kernel.org/all/asNhLGdigxSqU5Op@xxxxxxxxxxxxxxxxxxxx/
I assume this was something flagged by coccinelle here too, which you
should have mentioned in your commit message.
I don't know what the warning message looks like but the term
"potential" is key here. You still need to look at the code to determine
whether there is an actual issue or not.
Johan