summaryrefslogtreecommitdiff
path: root/scripts
diff options
context:
space:
mode:
authorJakob Koschel <jkl820.git@gmail.com>2023-03-13 16:59:19 +0300
committerWim Van Sebroeck <wim@linux-watchdog.org>2023-04-22 13:54:00 +0300
commit33e4945352a2484c92fc1d5a16471b1939d67abb (patch)
tree13d5e58d384308116218010992a9037dc0302d45 /scripts
parentfc0c5db58f4c78b948acfbf9558eeaf6b343bf9a (diff)
downloadlinux-33e4945352a2484c92fc1d5a16471b1939d67abb.tar.xz
watchdog: avoid usage of iterator after loop
If potentially no valid element is found, 'p' would contain an invalid pointer past the iterator loop. To ensure 'p' is valid under any circumstances, the kfree() should be within the loop body. Additionally, Linus proposed to avoid any use of the list iterator variable after the loop, in the attempt to move the list iterator variable declaration into the macro to avoid any potential misuse after the loop [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> Reviewed-by: Guenter Roeck <linux@roeck-us.net> Link: https://lore.kernel.org/r/20230301-watchdog-avoid-iter-after-loop-v2-1-8411e3bbe0de@gmail.com Signed-off-by: Guenter Roeck <linux@roeck-us.net> Signed-off-by: Wim Van Sebroeck <wim@linux-watchdog.org>
Diffstat (limited to 'scripts')
0 files changed, 0 insertions, 0 deletions