Commit f4012c8b authored by Srinivas Pandruvada's avatar Srinivas Pandruvada Committed by jiayingbao
Browse files

platform/x86/intel/tpmi: Prevent overflow for cap_offset

mainline inclusion
from mainline-v6.5-rc2
commit 5b2a4a43
category: feature
bugzilla: https://gitee.com/openeuler/intel-kernel/issues/I8WOEC

Reference: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=5b2a4a4394ce96fb01a282dd58e263d02218db03



-------------------------------------

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.

Intel-SIG: commit 5b2a4a43 platform/x86/intel/tpmi: Prevent overflow for cap_offset.
Backport Intel_tpmi base driver.

Signed-off-by: default avatarSrinivas Pandruvada <srinivas.pandruvada@linux.intel.com>
Link: https://lore.kernel.org/r/20230622195717.3125088-1-srinivas.pandruvada@linux.intel.com


Reviewed-by: default avatarHans de Goede <hdegoede@redhat.com>
Signed-off-by: default avatarHans de Goede <hdegoede@redhat.com>
[ Yingbao Jia: amend commit log ]
Signed-off-by: default avatarYingbao Jia <yingbao.jia@intel.com>
parent 4beedc1a
Loading
Loading
Loading
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please to comment