diff options
author | Jithu Joseph <[email protected]> | 2023-10-05 12:51:34 -0700 |
---|---|---|
committer | Ilpo Järvinen <[email protected]> | 2023-10-06 13:05:21 +0300 |
commit | 60d2e1b37d530d6b1f8b7773cebaf8bbc1536b28 (patch) | |
tree | 290370d2b7599d99f3ca3b2b888a03e1438b5878 | |
parent | 25a76dbb36dd58ad4df7f6a4dc43061a10b0d817 (diff) |
platform/x86/intel/ifs: Metadata validation for start_chunk
Add an additional check to validate IFS image metadata field prior to
loading the test image.
If start_chunk is not a multiple of chunks_per_stride error out.
Signed-off-by: Jithu Joseph <[email protected]>
Reviewed-by: Tony Luck <[email protected]>
Tested-by: Pengfei Xu <[email protected]>
Link: https://lore.kernel.org/r/[email protected]
Reviewed-by: Ilpo Järvinen <[email protected]>
Signed-off-by: Ilpo Järvinen <[email protected]>
-rw-r--r-- | drivers/platform/x86/intel/ifs/load.c | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/drivers/platform/x86/intel/ifs/load.c b/drivers/platform/x86/intel/ifs/load.c index 582f1801aaaa..959b1878cae6 100644 --- a/drivers/platform/x86/intel/ifs/load.c +++ b/drivers/platform/x86/intel/ifs/load.c @@ -291,6 +291,13 @@ static int validate_ifs_metadata(struct device *dev) return ret; } + if (ifs_meta->chunks_per_stride && + (ifs_meta->starting_chunk % ifs_meta->chunks_per_stride != 0)) { + dev_warn(dev, "Starting chunk num %u not a multiple of chunks_per_stride %u\n", + ifs_meta->starting_chunk, ifs_meta->chunks_per_stride); + return ret; + } + return 0; } |