]> git.ipfire.org Git - thirdparty/kernel/stable.git/commit
selftests/sgx: Fix uninitialized pointer dereferences in encl_get_entry
authorJo Van Bulck <jo.vanbulck@cs.kuleuven.be>
Thu, 5 Oct 2023 15:38:43 +0000 (17:38 +0200)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Thu, 25 Jan 2024 23:27:46 +0000 (15:27 -0800)
commit2cfae256a13095ed3fe78d7ec4e91ce5cf9d5536
treec9f9252e87eb5ab5d40ffff3fc6295daebfa934c
parenteb41e7e8b4b3d462fd2d60ac1d7ec8d6da66cd33
selftests/sgx: Fix uninitialized pointer dereferences in encl_get_entry

[ Upstream commit b84fc2e0139ba4b23b8039bd7cfd242894fe8f8b ]

Ensure sym_tab and sym_names are zero-initialized and add an early-out
condition in the unlikely (erroneous) case that the enclave ELF file would
not contain a symbol table.

This addresses -Werror=maybe-uninitialized compiler warnings for gcc -O2.

Fixes: 33c5aac3bf32 ("selftests/sgx: Test complete changing of page type flow")
Signed-off-by: Jo Van Bulck <jo.vanbulck@cs.kuleuven.be>
Signed-off-by: Dave Hansen <dave.hansen@linux.intel.com>
Reviewed-by: Jarkko Sakkinen <jarkko@kernel.org>
Link: https://lore.kernel.org/all/20231005153854.25566-3-jo.vanbulck%40cs.kuleuven.be
Signed-off-by: Sasha Levin <sashal@kernel.org>
tools/testing/selftests/sgx/load.c