diff options
author | Jakob Koschel <[email protected]> | 2023-03-01 12:17:29 +0100 |
---|---|---|
committer | Borislav Petkov (AMD) <[email protected]> | 2023-06-13 16:21:01 +0200 |
commit | 1e327963cfab0e02eeeb0331178d6c353c959cd6 (patch) | |
tree | 931ed8965aa0f173ca15939117b1386409fa7ae1 /scripts/gdb/linux | |
parent | 858fd168a95c5b9669aac8db6c14a9aeab446375 (diff) |
x86/sgx: Avoid using iterator after loop in sgx_mmu_notifier_release()
If &encl_mm->encl->mm_list does not contain the searched 'encl_mm',
'tmp' will not point to a valid sgx_encl_mm struct.
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. Using it in
a pointer comparison after the loop is undefined behavior and should be
omitted if possible, see Link tag.
Instead, just use a 'found' boolean to indicate if an element was found.
[ bp: Massage, fix typos. ]
Signed-off-by: Jakob Koschel <[email protected]>
Signed-off-by: Borislav Petkov (AMD) <[email protected]>
Reviewed-by: Jarkko Sakkinen <[email protected]>
Acked-by: Dave Hansen <[email protected]>
Link: https://lore.kernel.org/all/CAHk-=wgRr_D8CB-D9Kg-c=EHreAsk5SqXPwr9Y7k9sA6cWXJ6w@mail.gmail.com/
Link: https://lore.kernel.org/r/[email protected]
Diffstat (limited to 'scripts/gdb/linux')
0 files changed, 0 insertions, 0 deletions