Skip to content

Commit 5b2a4a4

Browse files
spandruvadajwrdegoede
authored andcommitted
platform/x86/intel/tpmi: Prevent overflow for cap_offset
cap_offset is a u16 field, so multiplying with TPMI_CAP_OFFSET_UNIT (which is equal to 1024) to covert to bytes will cause overflow. This will be a problem once more TPMI features are added. This field is not used except for calculating pfs->vsec_offset. So, leave cap_offset field unchanged and multiply with TPMI_CAP_OFFSET_UNIT while calculating pfs->vsec_offset. Signed-off-by: Srinivas Pandruvada <[email protected]> Link: https://lore.kernel.org/r/[email protected] Reviewed-by: Hans de Goede <[email protected]> Signed-off-by: Hans de Goede <[email protected]>
1 parent 6bf06f1 commit 5b2a4a4

File tree

1 file changed

+1
-3
lines changed
  • drivers/platform/x86/intel

1 file changed

+1
-3
lines changed

drivers/platform/x86/intel/tpmi.c

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -356,9 +356,7 @@ static int intel_vsec_tpmi_init(struct auxiliary_device *auxdev)
356356
if (!pfs_start)
357357
pfs_start = res_start;
358358

359-
pfs->pfs_header.cap_offset *= TPMI_CAP_OFFSET_UNIT;
360-
361-
pfs->vsec_offset = pfs_start + pfs->pfs_header.cap_offset;
359+
pfs->vsec_offset = pfs_start + pfs->pfs_header.cap_offset * TPMI_CAP_OFFSET_UNIT;
362360

363361
/*
364362
* Process TPMI_INFO to get PCI device to CPU package ID.

0 commit comments

Comments
 (0)