[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <62cf35b4-c317-ed2f-46e0-2c22119b04e8@linux.intel.com>
Date: Fri, 24 Jan 2025 10:04:00 +0200 (EET)
From: Ilpo Järvinen <ilpo.jarvinen@...ux.intel.com>
To: Dmitry Kandybka <d.kandybka@...il.com>
cc: Rajneesh Bhardwaj <irenic.rajneesh@...il.com>,
David E Box <david.e.box@...el.com>, Hans de Goede <hdegoede@...hat.com>,
platform-driver-x86@...r.kernel.org, LKML <linux-kernel@...r.kernel.org>,
lvc-project@...uxtesting.org
Subject: Re: [PATCH v2] platform/x86/intel: pmc: fix ltr decode in
pmc_core_ltr_show()
On Fri, 24 Jan 2025, Dmitry Kandybka wrote:
> 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@...il.com>
> ---
> v1 -> v2: 'val' variable declared as 'u64' instead of type casting
> at usage points
>
> drivers/platform/x86/intel/pmc/core.c | 4 ++--
> 1 file changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/platform/x86/intel/pmc/core.c b/drivers/platform/x86/intel/pmc/core.c
> index 10f04b944117..1ee0fb5f8250 100644
> --- a/drivers/platform/x86/intel/pmc/core.c
> +++ b/drivers/platform/x86/intel/pmc/core.c
> @@ -626,8 +626,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;
Thanks for the update,
Reviewed-by: Ilpo Järvinen <ilpo.jarvinen@...ux.intel.com>
--
i.
Powered by blists - more mailing lists