Skip to content

Commit 8ea6a15

Browse files
nurhsmb49
authored andcommitted
drm/tegra: Avoid potential 32-bit integer overflow
BugLink: https://bugs.launchpad.net/bugs/2028408 [ 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: Kamal Mostafa <kamal@canonical.com> Signed-off-by: Stefan Bader <stefan.bader@canonical.com>
1 parent 74c47a6 commit 8ea6a15

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
@@ -1153,7 +1153,7 @@ static int tegra_sor_compute_config(struct tegra_sor *sor,
11531153
struct drm_dp_link *link)
11541154
{
11551155
const u64 f = 100000, link_rate = link->rate * 1000;
1156-
const u64 pclk = mode->clock * 1000;
1156+
const u64 pclk = (u64)mode->clock * 1000;
11571157
u64 input, output, watermark, num;
11581158
struct tegra_sor_params params;
11591159
u32 num_syms_per_line;

0 commit comments

Comments
 (0)