From 35d3c1054a69565936d9b59eba0fc2cf5b17fea0 Mon Sep 17 00:00:00 2001 From: Takashi Iwai Date: May 25 2023 06:19:05 +0000 Subject: drm/tegra: Avoid potential 32-bit integer overflow (git-fixes). --- diff --git a/patches.suse/drm-tegra-Avoid-potential-32-bit-integer-overflow.patch b/patches.suse/drm-tegra-Avoid-potential-32-bit-integer-overflow.patch new file mode 100644 index 0000000..30c44f8 --- /dev/null +++ b/patches.suse/drm-tegra-Avoid-potential-32-bit-integer-overflow.patch @@ -0,0 +1,37 @@ +From 2429b3c529da29d4277d519bd66d034842dcd70c Mon Sep 17 00:00:00 2001 +From: Nur Hussein +Date: Thu, 6 Apr 2023 04:25:59 +0800 +Subject: [PATCH] drm/tegra: Avoid potential 32-bit integer overflow +Git-commit: 2429b3c529da29d4277d519bd66d034842dcd70c +Patch-mainline: v6.4-rc1 +References: git-fixes + +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 +Signed-off-by: Thierry Reding +Acked-by: Takashi Iwai + +--- + drivers/gpu/drm/tegra/sor.c | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/drivers/gpu/drm/tegra/sor.c b/drivers/gpu/drm/tegra/sor.c +index cd25f409979c..8d910695775c 100644 +--- a/drivers/gpu/drm/tegra/sor.c ++++ b/drivers/gpu/drm/tegra/sor.c +@@ -1153,7 +1153,7 @@ static int tegra_sor_compute_config(struct tegra_sor *sor, + struct drm_dp_link *link) + { + const u64 f = 100000, link_rate = link->rate * 1000; +- const u64 pclk = mode->clock * 1000; ++ const u64 pclk = (u64)mode->clock * 1000; + u64 input, output, watermark, num; + struct tegra_sor_params params; + u32 num_syms_per_line; +-- +2.35.3 + diff --git a/series.conf b/series.conf index 262903a..b5118b2 100644 --- a/series.conf +++ b/series.conf @@ -19835,6 +19835,7 @@ patches.suse/drm-bridge-lt8912b-Fix-DSI-Video-Mode.patch patches.suse/drm-fb-helper-set-x-yres_virtual-in-drm_fb_helper_ch.patch patches.suse/drm-ttm-pool-Fix-ttm_pool_alloc-error-path.patch + patches.suse/drm-tegra-Avoid-potential-32-bit-integer-overflow.patch patches.suse/drm-msm-disp-dpu-check-for-crtc-enable-rather-than-c.patch patches.suse/drm-msm-adreno-drop-bogus-pm_runtime_set_active.patch patches.suse/drm-msm-adreno-Disable-preemption-on-Adreno-510.patch