platform/x86/intel/ifs: Remove memory allocation from load path
authorJithu Joseph <jithu.joseph@intel.com>
Thu, 17 Nov 2022 19:59:57 +0000 (11:59 -0800)
committerBorislav Petkov <bp@suse.de>
Fri, 18 Nov 2022 20:43:18 +0000 (21:43 +0100)
commitcb5eceee816bf05667089869d822b9cbc919465a
tree60ada247a17aa91e9b42954131f4b114f156253b
parenta4c30fa4ead5e6628e5ff5a45664ba7181acf6f1
platform/x86/intel/ifs: Remove memory allocation from load path

IFS requires tests to be authenticated once for each CPU socket on a
system.

scan_chunks_sanity_check() was dynamically allocating memory to store
the state of whether tests have been authenticated on each socket for
every load operation.

Move the memory allocation to init path and store the pointer in
ifs_data struct.

Also rearrange the adjacent error checking in init for a more simplified
and natural flow.

Suggested-by: Borislav Petkov <bp@alien8.de>
Signed-off-by: Jithu Joseph <jithu.joseph@intel.com>
Signed-off-by: Borislav Petkov <bp@suse.de>
Reviewed-by: Tony Luck <tony.luck@intel.com>
Reviewed-by: Hans de Goede <hdegoede@redhat.com>
Link: https://lore.kernel.org/r/20221117195957.28225-1-jithu.joseph@intel.com
drivers/platform/x86/intel/ifs/core.c
drivers/platform/x86/intel/ifs/ifs.h
drivers/platform/x86/intel/ifs/load.c