Skip to content

Commit 28055d5

Browse files
committed
platform/x86/intel: pmc: fix ltr decode in pmc_core_ltr_show()
JIRA: https://issues.redhat.com/browse/RHEL-79553 commit 583ef25 Author: Dmitry Kandybka <[email protected]> Date: Fri Jan 24 01:07:39 2025 +0300 platform/x86/intel: pmc: fix ltr decode in pmc_core_ltr_show() In pmc_core_ltr_show(), promote 'val' to 'u64' to avoid possible integer overflow. Values (10 bit) are multiplied by the scale, the result of expression is in a range from 1 to 34,326,183,936 which is bigger then UINT32_MAX. Compile tested only. Found by Linux Verification Center (linuxtesting.org) with SVACE. Signed-off-by: Dmitry Kandybka <[email protected]> Reviewed-by: Rajneesh Bhardwaj <[email protected]> Reviewed-by: Ilpo Järvinen <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Ilpo Järvinen <[email protected]> Signed-off-by: David Arcari <[email protected]>
1 parent 310dfb7 commit 28055d5

File tree

1 file changed

+2
-2
lines changed
  • drivers/platform/x86/intel/pmc

1 file changed

+2
-2
lines changed

drivers/platform/x86/intel/pmc/core.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -626,8 +626,8 @@ static u32 convert_ltr_scale(u32 val)
626626
static int pmc_core_ltr_show(struct seq_file *s, void *unused)
627627
{
628628
struct pmc_dev *pmcdev = s->private;
629-
u64 decoded_snoop_ltr, decoded_non_snoop_ltr;
630-
u32 ltr_raw_data, scale, val;
629+
u64 decoded_snoop_ltr, decoded_non_snoop_ltr, val;
630+
u32 ltr_raw_data, scale;
631631
u16 snoop_ltr, nonsnoop_ltr;
632632
unsigned int i, index, ltr_index = 0;
633633

0 commit comments

Comments
 (0)