Skip to content

Commit 8074b55

Browse files
dmikandopsiff
authored andcommitted
platform/x86/intel: pmc: fix ltr decode in pmc_core_ltr_show()
[ Upstream commit 583ef25 ] 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 <d.kandybka@gmail.com> Reviewed-by: Rajneesh Bhardwaj <irenic.rajneesh@gmail.com> Reviewed-by: Ilpo Järvinen <ilpo.jarvinen@linux.intel.com> Link: https://lore.kernel.org/r/20250123220739.68087-1-d.kandybka@gmail.com Signed-off-by: Ilpo Järvinen <ilpo.jarvinen@linux.intel.com> Signed-off-by: Sasha Levin <sashal@kernel.org> (cherry picked from commit c79ac6a)
1 parent b37ef20 commit 8074b55

1 file changed

Lines changed: 2 additions & 2 deletions

File tree

  • drivers/platform/x86/intel/pmc

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -636,8 +636,8 @@ static u32 convert_ltr_scale(u32 val)
636636
static int pmc_core_ltr_show(struct seq_file *s, void *unused)
637637
{
638638
struct pmc_dev *pmcdev = s->private;
639-
u64 decoded_snoop_ltr, decoded_non_snoop_ltr;
640-
u32 ltr_raw_data, scale, val;
639+
u64 decoded_snoop_ltr, decoded_non_snoop_ltr, val;
640+
u32 ltr_raw_data, scale;
641641
u16 snoop_ltr, nonsnoop_ltr;
642642
int i, index, ltr_index = 0;
643643

0 commit comments

Comments
 (0)