Skip to content

Commit 2429b3c

Browse files
nurhthierryreding
authored andcommitted
drm/tegra: Avoid potential 32-bit integer overflow
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 <[email protected]> Signed-off-by: Thierry Reding <[email protected]>
1 parent 71ec16f commit 2429b3c

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)