Thanks for the clarification, Johan.
You are right, it was flagged by a tool and I missed verifying it against the actual code logic.
I will drop this patch.
And also will check the code again
Thanks, Rahul
On Wed, 7 Oct 2026 at 3:12 PM, Johan Hovold johan@kernel.org wrote:
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@hovoldconsulting.com/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