All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] drm/msm/submit: fix overflow check on 64-bit architectures
@ 2021-09-27 11:36 Arnd Bergmann
  2021-09-27 21:09   ` Stephen Boyd
  0 siblings, 1 reply; 3+ messages in thread
From: Arnd Bergmann @ 2021-09-27 11:36 UTC (permalink / raw)
  To: Rob Clark, Sean Paul, David Airlie, Daniel Vetter,
	Nathan Chancellor, Nick Desaulniers, Kristian H. Kristensen
  Cc: Arnd Bergmann, Christian König, Jordan Crouse,
	linux-arm-msm, dri-devel, freedreno, linux-kernel, llvm

From: Arnd Bergmann <arnd@arndb.de>

The overflow check does causes a warning from clang-14 when 'sz' is a type
that is smaller than size_t:

drivers/gpu/drm/msm/msm_gem_submit.c:217:10: error: result of comparison of constant 18446744073709551615 with expression of type 'unsigned int' is always false [-Werror,-Wtautological-constant-out-of-range-compare]
                if (sz == SIZE_MAX) {

Change the type accordingly.

Fixes: 20224d715a88 ("drm/msm/submit: Move copy_from_user ahead of locking bos")
Signed-off-by: Arnd Bergmann <arnd@arndb.de>
---
 drivers/gpu/drm/msm/msm_gem_submit.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/drivers/gpu/drm/msm/msm_gem_submit.c b/drivers/gpu/drm/msm/msm_gem_submit.c
index fdc5367aecaa..ac23bbdb0bab 100644
--- a/drivers/gpu/drm/msm/msm_gem_submit.c
+++ b/drivers/gpu/drm/msm/msm_gem_submit.c
@@ -171,7 +171,8 @@ static int submit_lookup_objects(struct msm_gem_submit *submit,
 static int submit_lookup_cmds(struct msm_gem_submit *submit,
 		struct drm_msm_gem_submit *args, struct drm_file *file)
 {
-	unsigned i, sz;
+	unsigned i;
+	size_t sz;
 	int ret = 0;
 
 	for (i = 0; i < args->nr_cmds; i++) {
-- 
2.29.2


^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH] drm/msm/submit: fix overflow check on 64-bit architectures
  2021-09-27 11:36 [PATCH] drm/msm/submit: fix overflow check on 64-bit architectures Arnd Bergmann
@ 2021-09-27 21:09   ` Stephen Boyd
  0 siblings, 0 replies; 3+ messages in thread
From: Stephen Boyd @ 2021-09-27 21:09 UTC (permalink / raw)
  To: Arnd Bergmann, Daniel Vetter, David Airlie,
	Kristian H. Kristensen, Nathan Chancellor, Nick Desaulniers,
	Rob Clark, Sean Paul
  Cc: Arnd Bergmann, Christian König, Jordan Crouse,
	linux-arm-msm, dri-devel, freedreno, linux-kernel, llvm

Quoting Arnd Bergmann (2021-09-27 04:36:23)
> From: Arnd Bergmann <arnd@arndb.de>
>
> The overflow check does causes a warning from clang-14 when 'sz' is a type
> that is smaller than size_t:
>
> drivers/gpu/drm/msm/msm_gem_submit.c:217:10: error: result of comparison of constant 18446744073709551615 with expression of type 'unsigned int' is always false [-Werror,-Wtautological-constant-out-of-range-compare]
>                 if (sz == SIZE_MAX) {
>
> Change the type accordingly.
>
> Fixes: 20224d715a88 ("drm/msm/submit: Move copy_from_user ahead of locking bos")
> Signed-off-by: Arnd Bergmann <arnd@arndb.de>
> ---

Reviewed-by: Stephen Boyd <swboyd@chromium.org>

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] drm/msm/submit: fix overflow check on 64-bit architectures
@ 2021-09-27 21:09   ` Stephen Boyd
  0 siblings, 0 replies; 3+ messages in thread
From: Stephen Boyd @ 2021-09-27 21:09 UTC (permalink / raw)
  To: Arnd Bergmann, Daniel Vetter, David Airlie,
	Kristian H. Kristensen, Nathan Chancellor, Nick Desaulniers,
	Rob Clark, Sean Paul
  Cc: Arnd Bergmann, Christian König, Jordan Crouse,
	linux-arm-msm, dri-devel, freedreno, linux-kernel, llvm

Quoting Arnd Bergmann (2021-09-27 04:36:23)
> From: Arnd Bergmann <arnd@arndb.de>
>
> The overflow check does causes a warning from clang-14 when 'sz' is a type
> that is smaller than size_t:
>
> drivers/gpu/drm/msm/msm_gem_submit.c:217:10: error: result of comparison of constant 18446744073709551615 with expression of type 'unsigned int' is always false [-Werror,-Wtautological-constant-out-of-range-compare]
>                 if (sz == SIZE_MAX) {
>
> Change the type accordingly.
>
> Fixes: 20224d715a88 ("drm/msm/submit: Move copy_from_user ahead of locking bos")
> Signed-off-by: Arnd Bergmann <arnd@arndb.de>
> ---

Reviewed-by: Stephen Boyd <swboyd@chromium.org>

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2021-09-27 21:09 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-09-27 11:36 [PATCH] drm/msm/submit: fix overflow check on 64-bit architectures Arnd Bergmann
2021-09-27 21:09 ` Stephen Boyd
2021-09-27 21:09   ` Stephen Boyd

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.