platform/x86/intel: pmc: fix ltr decode in pmc_core_ltr_show()
[ Upstream commit 583ef25bb2a094813351a727ddec38b35a15b9f8 ] 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>
This commit is contained in:
committed by
Greg Kroah-Hartman
parent
20d6994b6f
commit
8bf1b5eeaf
@@ -625,8 +625,8 @@ static u32 convert_ltr_scale(u32 val)
|
||||
static int pmc_core_ltr_show(struct seq_file *s, void *unused)
|
||||
{
|
||||
struct pmc_dev *pmcdev = s->private;
|
||||
u64 decoded_snoop_ltr, decoded_non_snoop_ltr;
|
||||
u32 ltr_raw_data, scale, val;
|
||||
u64 decoded_snoop_ltr, decoded_non_snoop_ltr, val;
|
||||
u32 ltr_raw_data, scale;
|
||||
u16 snoop_ltr, nonsnoop_ltr;
|
||||
unsigned int i, index, ltr_index = 0;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user