summaryrefslogtreecommitdiff
path: root/drivers/platform/x86/think-lmi.c
diff options
context:
space:
mode:
authorDavid E. Box <david.e.box@linux.intel.com>2021-08-13 18:47:28 -0700
committerHans de Goede <hdegoede@redhat.com>2021-08-17 20:53:10 +0200
commit45b6f75eab6aabf9d88933830f41f532d39f38d2 (patch)
treefe122cbd35b1e1b083069bfcd45c06504d41b4c1 /drivers/platform/x86/think-lmi.c
parent2010319b3c438ba428e9a5c54998c5b05631cf78 (diff)
platform/x86: intel_pmc_core: Prevent possibile overflow
Substate priority levels are encoded in 4 bits in the LPM_PRI register. This value was used as an index to an array whose element size was less than 16, leading to the possibility of overflow should we read a larger than expected priority. In addition to the overflow, bad values could lead to incorrect state reporting. So rework the priority code to prevent the overflow and perform some validation of the register. Use the priority register values if they give an ordering of unique numbers between 0 and the maximum number of states. Otherwise, use a default ordering instead. Reported-by: Evgeny Novikov <novikov@ispras.ru> Signed-off-by: David E. Box <david.e.box@linux.intel.com> Reviewed-by: Andy Shevchenko <andy.shevchenko@gmail.com> Link: https://lore.kernel.org/r/20210814014728.520856-1-david.e.box@linux.intel.com Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Diffstat (limited to 'drivers/platform/x86/think-lmi.c')
0 files changed, 0 insertions, 0 deletions