Re: [PATCH] staging: vme_user: avoid iterator variable access outside list loop
From: Dan Carpenter
Date: Fri Oct 16 2026 - 04:48:52 EST
On Sun, Oct 11, 2026 at 10:40:20PM -0500, Riccardo Oliva wrote:
> In vme_slave_request(), vme_master_request(), vme_dma_request(), and
> vme_lm_request(), the list iterators (slave_image, master_image,
> dma_ctrlr, and lm) are accessed in the err_alloc error paths after
> exiting the list_for_each_entry() loops.
>
> While the iterator variable retains its pointer value upon hitting a
> break, accessing list iterators outside the loop body violates modern
> kernel coding standards.
>
> Fix this by referencing the dedicated allocated resource pointers
> (allocated_image, allocated_ctrlr, allocated_lm) in the error cleanup
> blocks instead.
>
> Signed-off-by: Riccardo Oliva <oliva.scorza@xxxxxxxxx>
> ---
> Hi! This is my first patch to the kernel. I am learning the submission
> workflow. Any feedback is very much appreciated. Thanks!
>
You should generally assume old warnings are false positives.
There is a check which tests if we found the image or not.
regards,
dan carpenter