]> git.proxmox.com Git - mirror_ubuntu-jammy-kernel.git/commit
mei: avoid iterator usage outside of list_for_each_entry
authorAlexander Usyskin <alexander.usyskin@intel.com>
Tue, 8 Mar 2022 09:59:26 +0000 (11:59 +0200)
committerStefan Bader <stefan.bader@canonical.com>
Wed, 27 Apr 2022 09:56:25 +0000 (11:56 +0200)
commit87584eabbb6c8205e1be8bd8174725bdec1f6cbd
tree401923a0e021ca177fa10b2ab3904115708bd363
parent4cee23b8619f37b182c426950f733703330e37d5
mei: avoid iterator usage outside of list_for_each_entry

BugLink: https://bugs.launchpad.net/bugs/1969110
commit c10187b1c5ebb8681ca467ab7b0ded5ea415d258 upstream.

Usage of the iterator outside of the list_for_each_entry
is considered harmful. https://lkml.org/lkml/2022/2/17/1032

Do not reference the loop variable outside of the loop,
by rearranging the orders of execution.
Instead of performing search loop and checking outside the loop
if the end of the list was hit and no matching element was found,
the execution is performed inside the loop upon a successful match
followed by a goto statement to the next step,
therefore no condition has to be performed after the loop has ended.

Cc: <stable@vger.kernel.org>
Signed-off-by: Alexander Usyskin <alexander.usyskin@intel.com>
Signed-off-by: Tomas Winkler <tomas.winkler@intel.com>
Link: https://lore.kernel.org/r/20220308095926.300412-1-tomas.winkler@intel.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
(cherry picked from commit 84bb0ac6c86f705af253789d382a684759cb2d72)
Signed-off-by: Paolo Pisati <paolo.pisati@canonical.com>
drivers/misc/mei/interrupt.c