mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH] drm/i915/guc: Fix UB due to signed int overflow
@ 2024-04-13  3:17 Dmitrii Bundin
  2024-05-02 10:36 ` [PATCH RESEND] " Dmitrii Bundin
  0 siblings, 1 reply; 2+ messages in thread
From: Dmitrii Bundin @ 2024-04-13  3:17 UTC (permalink / raw)
  To: linux-kernel
  Cc: jani.nikula, joonas.lahtinen, rodrigo.vivi, tursulin, airlied,
	daniel, dmitrii.bundin.a, intel-gfx, dri-devel, bp, gongruiqi1,
	rdunlap, michal.wajdeczko

Fix compile errors of the form "FIELD_PREP: mask is not constant" caused
by signed integer constant overflow. Files affected:

drivers/gpu/drm/i915/gt/uc/intel_guc_submission.c

Reproducible with gcc 7.5

Signed-off-by: Dmitrii Bundin <dmitrii.bundin.a@gmail.com>
---
 drivers/gpu/drm/i915/gt/uc/abi/guc_klvs_abi.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/gpu/drm/i915/gt/uc/abi/guc_klvs_abi.h b/drivers/gpu/drm/i915/gt/uc/abi/guc_klvs_abi.h
index 58012edd4eb0..8814d4cd371c 100644
--- a/drivers/gpu/drm/i915/gt/uc/abi/guc_klvs_abi.h
+++ b/drivers/gpu/drm/i915/gt/uc/abi/guc_klvs_abi.h
@@ -29,7 +29,7 @@
  */
 
 #define GUC_KLV_LEN_MIN				1u
-#define GUC_KLV_0_KEY				(0xffff << 16)
+#define GUC_KLV_0_KEY				(0xffffU << 16)
 #define GUC_KLV_0_LEN				(0xffff << 0)
 #define GUC_KLV_n_VALUE				(0xffffffff << 0)
 
-- 
2.34.1


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

* [PATCH RESEND] drm/i915/guc: Fix UB due to signed int overflow
  2024-04-13  3:17 [PATCH] drm/i915/guc: Fix UB due to signed int overflow Dmitrii Bundin
@ 2024-05-02 10:36 ` Dmitrii Bundin
  0 siblings, 0 replies; 2+ messages in thread
From: Dmitrii Bundin @ 2024-05-02 10:36 UTC (permalink / raw)
  To: dmitrii.bundin.a
  Cc: airlied, bp, daniel, dri-devel, gongruiqi1, intel-gfx,
	jani.nikula, joonas.lahtinen, linux-kernel, michal.wajdeczko,
	rdunlap, rodrigo.vivi, tursulin

Fix compile errors of the form "FIELD_PREP: mask is not constant" caused
by signed integer constant overflow. Files affected:

drivers/gpu/drm/i915/gt/uc/intel_guc_submission.c

Reproducible with gcc 7.5

See https://lore.kernel.org/r/YkwQ6%2BtIH8GQpuct@zn.tnic for the gory
details as to why it triggers with older gccs only.

Signed-off-by: Dmitrii Bundin <dmitrii.bundin.a@gmail.com>
---
 drivers/gpu/drm/i915/gt/uc/abi/guc_klvs_abi.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/gpu/drm/i915/gt/uc/abi/guc_klvs_abi.h b/drivers/gpu/drm/i915/gt/uc/abi/guc_klvs_abi.h
index 58012edd4eb0..8814d4cd371c 100644
--- a/drivers/gpu/drm/i915/gt/uc/abi/guc_klvs_abi.h
+++ b/drivers/gpu/drm/i915/gt/uc/abi/guc_klvs_abi.h
@@ -29,7 +29,7 @@
  */
 
 #define GUC_KLV_LEN_MIN				1u
-#define GUC_KLV_0_KEY				(0xffff << 16)
+#define GUC_KLV_0_KEY				(0xffffU << 16)
 #define GUC_KLV_0_LEN				(0xffff << 0)
 #define GUC_KLV_n_VALUE				(0xffffffff << 0)
 
-- 
2.34.1


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

end of thread, other threads:[~2024-05-02 10:36 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-04-13  3:17 [PATCH] drm/i915/guc: Fix UB due to signed int overflow Dmitrii Bundin
2024-05-02 10:36 ` [PATCH RESEND] " Dmitrii Bundin

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®