Skip to content

Commit fb034f5

Browse files
nurhSherryYang1
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 <[email protected]> Signed-off-by: Thierry Reding <[email protected]> Signed-off-by: Sasha Levin <[email protected]> (cherry picked from commit 99c8f2e6f33a17a812f3865f23be479aca98b59f) Signed-off-by: Sherry Yang <[email protected]>
1 parent 480603a commit fb034f5

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
@@ -906,7 +906,7 @@ static int tegra_sor_compute_config(struct tegra_sor *sor,
906906
struct drm_dp_link *link)
907907
{
908908
const u64 f = 100000, link_rate = link->rate * 1000;
909-
const u64 pclk = mode->clock * 1000;
909+
const u64 pclk = (u64)mode->clock * 1000;
910910
u64 input, output, watermark, num;
911911
struct tegra_sor_params params;
912912
u32 num_syms_per_line;

0 commit comments

Comments
 (0)