Skip to content

Commit a28cee9

Browse files
nurhUlrich Hecht
authored andcommitted
drm/tegra: Avoid potential 32-bit integer overflow
[ Upstream commit 2429b3c ] In tegra_sor_compute_config(), the 32-bit value mode->clock is multiplied by 1000, and assigned to the u64 variable pclk. We can avoid a potential 32-bit integer overflow by casting mode->clock to u64 before we do the arithmetic and assignment. Signed-off-by: Nur Hussein <hussein@unixcat.org> Signed-off-by: Thierry Reding <treding@nvidia.com> Signed-off-by: Sasha Levin <sashal@kernel.org> Signed-off-by: Ulrich Hecht <uli+cip@fpond.eu>
1 parent 4a89618 commit a28cee9

File tree

1 file changed

+1
-1
lines changed
  • drivers/gpu/drm/tegra

1 file changed

+1
-1
lines changed

drivers/gpu/drm/tegra/sor.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -575,7 +575,7 @@ static int tegra_sor_calc_config(struct tegra_sor *sor,
575575
struct drm_dp_link *link)
576576
{
577577
const u64 f = 100000, link_rate = link->rate * 1000;
578-
const u64 pclk = mode->clock * 1000;
578+
const u64 pclk = (u64)mode->clock * 1000;
579579
u64 input, output, watermark, num;
580580
struct tegra_sor_params params;
581581
u32 num_syms_per_line;

0 commit comments

Comments
 (0)