Skip to content

Commit 60d2e1b

Browse files
jithu83ij-intel
authored andcommitted
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 <jithu.joseph@intel.com> Reviewed-by: Tony Luck <tony.luck@intel.com> Tested-by: Pengfei Xu <pengfei.xu@intel.com> Link: https://lore.kernel.org/r/20231005195137.3117166-7-jithu.joseph@intel.com Reviewed-by: Ilpo Järvinen <ilpo.jarvinen@linux.intel.com> Signed-off-by: Ilpo Järvinen <ilpo.jarvinen@linux.intel.com>
1 parent 25a76db commit 60d2e1b

1 file changed

Lines changed: 7 additions & 0 deletions

File tree

  • drivers/platform/x86/intel/ifs

drivers/platform/x86/intel/ifs/load.c

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -291,6 +291,13 @@ static int validate_ifs_metadata(struct device *dev)
291291
return ret;
292292
}
293293

294+
if (ifs_meta->chunks_per_stride &&
295+
(ifs_meta->starting_chunk % ifs_meta->chunks_per_stride != 0)) {
296+
dev_warn(dev, "Starting chunk num %u not a multiple of chunks_per_stride %u\n",
297+
ifs_meta->starting_chunk, ifs_meta->chunks_per_stride);
298+
return ret;
299+
}
300+
294301
return 0;
295302
}
296303

0 commit comments

Comments
 (0)