* [PATCH][next] drm/amd/display: Fix potential integer overflow
@ 2021-02-10 21:23 ` Gustavo A. R. Silva
0 siblings, 0 replies; 6+ messages in thread
From: Gustavo A. R. Silva @ 2021-02-10 21:23 UTC (permalink / raw)
To: Harry Wentland, Leo Li, Alex Deucher, Christian König,
David Airlie, Daniel Vetter, Huang Rui, Anson Jacob, Lang Yu,
Nicholas Kazlauskas
Cc: amd-gfx, dri-devel, linux-kernel, Gustavo A. R. Silva
Fix potential integer overflow by casting actual_calculated_clock_100hz
to u64, in order to give the compiler complete information about the
proper arithmetic to use.
Notice that such variable is used in a context that expects
an expression of type u64 (64 bits, unsigned) and the following
expression is currently being evaluated using 32-bit arithmetic:
actual_calculated_clock_100hz * post_divider
Fixes: 7a03fdf628af ("drm/amd/display: fix 64bit division issue on 32bit OS")
Addresses-Coverity-ID: 1501691 ("Unintentional integer overflow")
Signed-off-by: Gustavo A. R. Silva <gustavoars@kernel.org>
---
drivers/gpu/drm/amd/display/dc/dce/dce_clock_source.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/gpu/drm/amd/display/dc/dce/dce_clock_source.c b/drivers/gpu/drm/amd/display/dc/dce/dce_clock_source.c
index bc942725b9d8..dec58b3c42e4 100644
--- a/drivers/gpu/drm/amd/display/dc/dce/dce_clock_source.c
+++ b/drivers/gpu/drm/amd/display/dc/dce/dce_clock_source.c
@@ -240,7 +240,7 @@ static bool calc_fb_divider_checking_tolerance(
pll_settings->calculated_pix_clk_100hz =
actual_calculated_clock_100hz;
pll_settings->vco_freq =
- div_u64(actual_calculated_clock_100hz * post_divider, 10);
+ div_u64((u64)actual_calculated_clock_100hz * post_divider, 10);
return true;
}
return false;
--
2.27.0
^ permalink raw reply related [flat|nested] 6+ messages in thread
* [PATCH][next] drm/amd/display: Fix potential integer overflow
@ 2021-02-10 21:23 ` Gustavo A. R. Silva
0 siblings, 0 replies; 6+ messages in thread
From: Gustavo A. R. Silva @ 2021-02-10 21:23 UTC (permalink / raw)
To: Harry Wentland, Leo Li, Alex Deucher, Christian König,
David Airlie, Daniel Vetter, Huang Rui, Anson Jacob, Lang Yu,
Nicholas Kazlauskas
Cc: Gustavo A. R. Silva, dri-devel, amd-gfx, linux-kernel
Fix potential integer overflow by casting actual_calculated_clock_100hz
to u64, in order to give the compiler complete information about the
proper arithmetic to use.
Notice that such variable is used in a context that expects
an expression of type u64 (64 bits, unsigned) and the following
expression is currently being evaluated using 32-bit arithmetic:
actual_calculated_clock_100hz * post_divider
Fixes: 7a03fdf628af ("drm/amd/display: fix 64bit division issue on 32bit OS")
Addresses-Coverity-ID: 1501691 ("Unintentional integer overflow")
Signed-off-by: Gustavo A. R. Silva <gustavoars@kernel.org>
---
drivers/gpu/drm/amd/display/dc/dce/dce_clock_source.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/gpu/drm/amd/display/dc/dce/dce_clock_source.c b/drivers/gpu/drm/amd/display/dc/dce/dce_clock_source.c
index bc942725b9d8..dec58b3c42e4 100644
--- a/drivers/gpu/drm/amd/display/dc/dce/dce_clock_source.c
+++ b/drivers/gpu/drm/amd/display/dc/dce/dce_clock_source.c
@@ -240,7 +240,7 @@ static bool calc_fb_divider_checking_tolerance(
pll_settings->calculated_pix_clk_100hz =
actual_calculated_clock_100hz;
pll_settings->vco_freq =
- div_u64(actual_calculated_clock_100hz * post_divider, 10);
+ div_u64((u64)actual_calculated_clock_100hz * post_divider, 10);
return true;
}
return false;
--
2.27.0
_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel
^ permalink raw reply related [flat|nested] 6+ messages in thread
* [PATCH][next] drm/amd/display: Fix potential integer overflow
@ 2021-02-10 21:23 ` Gustavo A. R. Silva
0 siblings, 0 replies; 6+ messages in thread
From: Gustavo A. R. Silva @ 2021-02-10 21:23 UTC (permalink / raw)
To: Harry Wentland, Leo Li, Alex Deucher, Christian König,
David Airlie, Daniel Vetter, Huang Rui, Anson Jacob, Lang Yu,
Nicholas Kazlauskas
Cc: Gustavo A. R. Silva, dri-devel, amd-gfx, linux-kernel
Fix potential integer overflow by casting actual_calculated_clock_100hz
to u64, in order to give the compiler complete information about the
proper arithmetic to use.
Notice that such variable is used in a context that expects
an expression of type u64 (64 bits, unsigned) and the following
expression is currently being evaluated using 32-bit arithmetic:
actual_calculated_clock_100hz * post_divider
Fixes: 7a03fdf628af ("drm/amd/display: fix 64bit division issue on 32bit OS")
Addresses-Coverity-ID: 1501691 ("Unintentional integer overflow")
Signed-off-by: Gustavo A. R. Silva <gustavoars@kernel.org>
---
drivers/gpu/drm/amd/display/dc/dce/dce_clock_source.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/gpu/drm/amd/display/dc/dce/dce_clock_source.c b/drivers/gpu/drm/amd/display/dc/dce/dce_clock_source.c
index bc942725b9d8..dec58b3c42e4 100644
--- a/drivers/gpu/drm/amd/display/dc/dce/dce_clock_source.c
+++ b/drivers/gpu/drm/amd/display/dc/dce/dce_clock_source.c
@@ -240,7 +240,7 @@ static bool calc_fb_divider_checking_tolerance(
pll_settings->calculated_pix_clk_100hz =
actual_calculated_clock_100hz;
pll_settings->vco_freq =
- div_u64(actual_calculated_clock_100hz * post_divider, 10);
+ div_u64((u64)actual_calculated_clock_100hz * post_divider, 10);
return true;
}
return false;
--
2.27.0
_______________________________________________
amd-gfx mailing list
amd-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/amd-gfx
^ permalink raw reply related [flat|nested] 6+ messages in thread
* Re: [PATCH][next] drm/amd/display: Fix potential integer overflow
2021-02-10 21:23 ` Gustavo A. R. Silva
(?)
@ 2021-02-15 18:51 ` Alex Deucher
-1 siblings, 0 replies; 6+ messages in thread
From: Alex Deucher @ 2021-02-15 18:51 UTC (permalink / raw)
To: Gustavo A. R. Silva
Cc: Harry Wentland, Leo Li, Alex Deucher, Christian König,
David Airlie, Daniel Vetter, Huang Rui, Anson Jacob, Lang Yu,
Nicholas Kazlauskas, Maling list - DRI developers, amd-gfx list,
LKML
On Wed, Feb 10, 2021 at 4:23 PM Gustavo A. R. Silva
<gustavoars@kernel.org> wrote:
>
> Fix potential integer overflow by casting actual_calculated_clock_100hz
> to u64, in order to give the compiler complete information about the
> proper arithmetic to use.
>
> Notice that such variable is used in a context that expects
> an expression of type u64 (64 bits, unsigned) and the following
> expression is currently being evaluated using 32-bit arithmetic:
>
> actual_calculated_clock_100hz * post_divider
>
> Fixes: 7a03fdf628af ("drm/amd/display: fix 64bit division issue on 32bit OS")
> Addresses-Coverity-ID: 1501691 ("Unintentional integer overflow")
> Signed-off-by: Gustavo A. R. Silva <gustavoars@kernel.org>
Applied. Thanks!
Alex
> ---
> drivers/gpu/drm/amd/display/dc/dce/dce_clock_source.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/drivers/gpu/drm/amd/display/dc/dce/dce_clock_source.c b/drivers/gpu/drm/amd/display/dc/dce/dce_clock_source.c
> index bc942725b9d8..dec58b3c42e4 100644
> --- a/drivers/gpu/drm/amd/display/dc/dce/dce_clock_source.c
> +++ b/drivers/gpu/drm/amd/display/dc/dce/dce_clock_source.c
> @@ -240,7 +240,7 @@ static bool calc_fb_divider_checking_tolerance(
> pll_settings->calculated_pix_clk_100hz =
> actual_calculated_clock_100hz;
> pll_settings->vco_freq =
> - div_u64(actual_calculated_clock_100hz * post_divider, 10);
> + div_u64((u64)actual_calculated_clock_100hz * post_divider, 10);
> return true;
> }
> return false;
> --
> 2.27.0
>
> _______________________________________________
> amd-gfx mailing list
> amd-gfx@lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/amd-gfx
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH][next] drm/amd/display: Fix potential integer overflow
@ 2021-02-15 18:51 ` Alex Deucher
0 siblings, 0 replies; 6+ messages in thread
From: Alex Deucher @ 2021-02-15 18:51 UTC (permalink / raw)
To: Gustavo A. R. Silva
Cc: Anson Jacob, Leo Li, Lang Yu, LKML, Maling list - DRI developers,
Nicholas Kazlauskas, David Airlie, Huang Rui, amd-gfx list,
Alex Deucher, Christian König
On Wed, Feb 10, 2021 at 4:23 PM Gustavo A. R. Silva
<gustavoars@kernel.org> wrote:
>
> Fix potential integer overflow by casting actual_calculated_clock_100hz
> to u64, in order to give the compiler complete information about the
> proper arithmetic to use.
>
> Notice that such variable is used in a context that expects
> an expression of type u64 (64 bits, unsigned) and the following
> expression is currently being evaluated using 32-bit arithmetic:
>
> actual_calculated_clock_100hz * post_divider
>
> Fixes: 7a03fdf628af ("drm/amd/display: fix 64bit division issue on 32bit OS")
> Addresses-Coverity-ID: 1501691 ("Unintentional integer overflow")
> Signed-off-by: Gustavo A. R. Silva <gustavoars@kernel.org>
Applied. Thanks!
Alex
> ---
> drivers/gpu/drm/amd/display/dc/dce/dce_clock_source.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/drivers/gpu/drm/amd/display/dc/dce/dce_clock_source.c b/drivers/gpu/drm/amd/display/dc/dce/dce_clock_source.c
> index bc942725b9d8..dec58b3c42e4 100644
> --- a/drivers/gpu/drm/amd/display/dc/dce/dce_clock_source.c
> +++ b/drivers/gpu/drm/amd/display/dc/dce/dce_clock_source.c
> @@ -240,7 +240,7 @@ static bool calc_fb_divider_checking_tolerance(
> pll_settings->calculated_pix_clk_100hz =
> actual_calculated_clock_100hz;
> pll_settings->vco_freq =
> - div_u64(actual_calculated_clock_100hz * post_divider, 10);
> + div_u64((u64)actual_calculated_clock_100hz * post_divider, 10);
> return true;
> }
> return false;
> --
> 2.27.0
>
> _______________________________________________
> amd-gfx mailing list
> amd-gfx@lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/amd-gfx
_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH][next] drm/amd/display: Fix potential integer overflow
@ 2021-02-15 18:51 ` Alex Deucher
0 siblings, 0 replies; 6+ messages in thread
From: Alex Deucher @ 2021-02-15 18:51 UTC (permalink / raw)
To: Gustavo A. R. Silva
Cc: Anson Jacob, Leo Li, Lang Yu, LKML, Maling list - DRI developers,
Nicholas Kazlauskas, David Airlie, Huang Rui, amd-gfx list,
Daniel Vetter, Alex Deucher, Harry Wentland,
Christian König
On Wed, Feb 10, 2021 at 4:23 PM Gustavo A. R. Silva
<gustavoars@kernel.org> wrote:
>
> Fix potential integer overflow by casting actual_calculated_clock_100hz
> to u64, in order to give the compiler complete information about the
> proper arithmetic to use.
>
> Notice that such variable is used in a context that expects
> an expression of type u64 (64 bits, unsigned) and the following
> expression is currently being evaluated using 32-bit arithmetic:
>
> actual_calculated_clock_100hz * post_divider
>
> Fixes: 7a03fdf628af ("drm/amd/display: fix 64bit division issue on 32bit OS")
> Addresses-Coverity-ID: 1501691 ("Unintentional integer overflow")
> Signed-off-by: Gustavo A. R. Silva <gustavoars@kernel.org>
Applied. Thanks!
Alex
> ---
> drivers/gpu/drm/amd/display/dc/dce/dce_clock_source.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/drivers/gpu/drm/amd/display/dc/dce/dce_clock_source.c b/drivers/gpu/drm/amd/display/dc/dce/dce_clock_source.c
> index bc942725b9d8..dec58b3c42e4 100644
> --- a/drivers/gpu/drm/amd/display/dc/dce/dce_clock_source.c
> +++ b/drivers/gpu/drm/amd/display/dc/dce/dce_clock_source.c
> @@ -240,7 +240,7 @@ static bool calc_fb_divider_checking_tolerance(
> pll_settings->calculated_pix_clk_100hz =
> actual_calculated_clock_100hz;
> pll_settings->vco_freq =
> - div_u64(actual_calculated_clock_100hz * post_divider, 10);
> + div_u64((u64)actual_calculated_clock_100hz * post_divider, 10);
> return true;
> }
> return false;
> --
> 2.27.0
>
> _______________________________________________
> amd-gfx mailing list
> amd-gfx@lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/amd-gfx
_______________________________________________
amd-gfx mailing list
amd-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/amd-gfx
^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2021-02-15 18:52 UTC | newest]
Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-02-10 21:23 [PATCH][next] drm/amd/display: Fix potential integer overflow Gustavo A. R. Silva
2021-02-10 21:23 ` Gustavo A. R. Silva
2021-02-10 21:23 ` Gustavo A. R. Silva
2021-02-15 18:51 ` Alex Deucher
2021-02-15 18:51 ` Alex Deucher
2021-02-15 18:51 ` Alex Deucher
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.