* [PATCH] drm/tegra: Fix shift overflow in tegra_shared_plane_atomic_update
@ 2021-04-15 15:29 ` Nathan Chancellor
0 siblings, 0 replies; 4+ messages in thread
From: Nathan Chancellor @ 2021-04-15 15:29 UTC (permalink / raw)
To: Thierry Reding
Cc: Jonathan Hunter, Nick Desaulniers, dri-devel, linux-tegra,
linux-kernel, clang-built-linux, Nathan Chancellor
Clang warns:
drivers/gpu/drm/tegra/hub.c:513:11: warning: shift count >= width of
type [-Wshift-count-overflow]
base |= BIT(39);
^~~~~~~
BIT is unsigned long, which is 32-bit on ARCH=arm, hence the overflow
warning. Switch to BIT_ULL, which is 64-bit and will not overflow.
Fixes: 7b6f846785f4 ("drm/tegra: Support sector layout on Tegra194")
Link: https://github.com/ClangBuiltLinux/linux/issues/1351
Signed-off-by: Nathan Chancellor <nathan@kernel.org>
---
drivers/gpu/drm/tegra/hub.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/gpu/drm/tegra/hub.c b/drivers/gpu/drm/tegra/hub.c
index 79bff8b48271..bfae8a02f55b 100644
--- a/drivers/gpu/drm/tegra/hub.c
+++ b/drivers/gpu/drm/tegra/hub.c
@@ -510,7 +510,7 @@ static void tegra_shared_plane_atomic_update(struct drm_plane *plane,
* dGPU sector layout.
*/
if (tegra_plane_state->tiling.sector_layout == TEGRA_BO_SECTOR_LAYOUT_GPU)
- base |= BIT(39);
+ base |= BIT_ULL(39);
#endif
tegra_plane_writel(p, tegra_plane_state->format, DC_WIN_COLOR_DEPTH);
base-commit: 0265531f0897f890da3f9c2958707af099c7d974
--
2.31.1.272.g89b43f80a5
^ permalink raw reply related [flat|nested] 4+ messages in thread
* [PATCH] drm/tegra: Fix shift overflow in tegra_shared_plane_atomic_update
@ 2021-04-15 15:29 ` Nathan Chancellor
0 siblings, 0 replies; 4+ messages in thread
From: Nathan Chancellor @ 2021-04-15 15:29 UTC (permalink / raw)
To: Thierry Reding
Cc: Nick Desaulniers, linux-kernel, dri-devel, Jonathan Hunter,
Nathan Chancellor, clang-built-linux, linux-tegra
Clang warns:
drivers/gpu/drm/tegra/hub.c:513:11: warning: shift count >= width of
type [-Wshift-count-overflow]
base |= BIT(39);
^~~~~~~
BIT is unsigned long, which is 32-bit on ARCH=arm, hence the overflow
warning. Switch to BIT_ULL, which is 64-bit and will not overflow.
Fixes: 7b6f846785f4 ("drm/tegra: Support sector layout on Tegra194")
Link: https://github.com/ClangBuiltLinux/linux/issues/1351
Signed-off-by: Nathan Chancellor <nathan@kernel.org>
---
drivers/gpu/drm/tegra/hub.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/gpu/drm/tegra/hub.c b/drivers/gpu/drm/tegra/hub.c
index 79bff8b48271..bfae8a02f55b 100644
--- a/drivers/gpu/drm/tegra/hub.c
+++ b/drivers/gpu/drm/tegra/hub.c
@@ -510,7 +510,7 @@ static void tegra_shared_plane_atomic_update(struct drm_plane *plane,
* dGPU sector layout.
*/
if (tegra_plane_state->tiling.sector_layout == TEGRA_BO_SECTOR_LAYOUT_GPU)
- base |= BIT(39);
+ base |= BIT_ULL(39);
#endif
tegra_plane_writel(p, tegra_plane_state->format, DC_WIN_COLOR_DEPTH);
base-commit: 0265531f0897f890da3f9c2958707af099c7d974
--
2.31.1.272.g89b43f80a5
_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel
^ permalink raw reply related [flat|nested] 4+ messages in thread
* Re: [PATCH] drm/tegra: Fix shift overflow in tegra_shared_plane_atomic_update
2021-04-15 15:29 ` Nathan Chancellor
@ 2021-04-15 15:49 ` Thierry Reding
-1 siblings, 0 replies; 4+ messages in thread
From: Thierry Reding @ 2021-04-15 15:49 UTC (permalink / raw)
To: Nathan Chancellor
Cc: Jonathan Hunter, Nick Desaulniers, dri-devel, linux-tegra,
linux-kernel, clang-built-linux
[-- Attachment #1: Type: text/plain, Size: 952 bytes --]
On Thu, Apr 15, 2021 at 08:29:14AM -0700, Nathan Chancellor wrote:
> Clang warns:
>
> drivers/gpu/drm/tegra/hub.c:513:11: warning: shift count >= width of
> type [-Wshift-count-overflow]
> base |= BIT(39);
> ^~~~~~~
>
> BIT is unsigned long, which is 32-bit on ARCH=arm, hence the overflow
> warning. Switch to BIT_ULL, which is 64-bit and will not overflow.
>
> Fixes: 7b6f846785f4 ("drm/tegra: Support sector layout on Tegra194")
> Link: https://github.com/ClangBuiltLinux/linux/issues/1351
> Signed-off-by: Nathan Chancellor <nathan@kernel.org>
> ---
> drivers/gpu/drm/tegra/hub.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
This code never runs on 32-bit platforms, so another option would be to
not try and build this on 32-bit configurations either. But none of the
rest of the code is built conditionally, so fixing this is preferable.
Applied, thanks.
Thierry
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 833 bytes --]
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH] drm/tegra: Fix shift overflow in tegra_shared_plane_atomic_update
@ 2021-04-15 15:49 ` Thierry Reding
0 siblings, 0 replies; 4+ messages in thread
From: Thierry Reding @ 2021-04-15 15:49 UTC (permalink / raw)
To: Nathan Chancellor
Cc: Nick Desaulniers, linux-kernel, dri-devel, Jonathan Hunter,
clang-built-linux, linux-tegra
[-- Attachment #1.1: Type: text/plain, Size: 952 bytes --]
On Thu, Apr 15, 2021 at 08:29:14AM -0700, Nathan Chancellor wrote:
> Clang warns:
>
> drivers/gpu/drm/tegra/hub.c:513:11: warning: shift count >= width of
> type [-Wshift-count-overflow]
> base |= BIT(39);
> ^~~~~~~
>
> BIT is unsigned long, which is 32-bit on ARCH=arm, hence the overflow
> warning. Switch to BIT_ULL, which is 64-bit and will not overflow.
>
> Fixes: 7b6f846785f4 ("drm/tegra: Support sector layout on Tegra194")
> Link: https://github.com/ClangBuiltLinux/linux/issues/1351
> Signed-off-by: Nathan Chancellor <nathan@kernel.org>
> ---
> drivers/gpu/drm/tegra/hub.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
This code never runs on 32-bit platforms, so another option would be to
not try and build this on 32-bit configurations either. But none of the
rest of the code is built conditionally, so fixing this is preferable.
Applied, thanks.
Thierry
[-- Attachment #1.2: signature.asc --]
[-- Type: application/pgp-signature, Size: 833 bytes --]
[-- Attachment #2: Type: text/plain, Size: 160 bytes --]
_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2021-04-15 15:48 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-04-15 15:29 [PATCH] drm/tegra: Fix shift overflow in tegra_shared_plane_atomic_update Nathan Chancellor
2021-04-15 15:29 ` Nathan Chancellor
2021-04-15 15:49 ` Thierry Reding
2021-04-15 15:49 ` Thierry Reding
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.