dri-devel Archive mirror
 help / color / mirror / Atom feed
From: Dmitrii Bundin <dmitrii.bundin.a@gmail.com>
To: dmitrii.bundin.a@gmail.com
Cc: airlied@gmail.com, bp@suse.de, daniel@ffwll.ch,
	dri-devel@lists.freedesktop.org, gongruiqi1@huawei.com,
	intel-gfx@lists.freedesktop.org, jani.nikula@linux.intel.com,
	joonas.lahtinen@linux.intel.com, linux-kernel@vger.kernel.org,
	michal.wajdeczko@intel.com, rdunlap@infradead.org,
	rodrigo.vivi@intel.com, tursulin@ursulin.net
Subject: [PATCH RESEND] drm/i915/guc: Fix UB due to signed int overflow
Date: Thu,  2 May 2024 13:36:18 +0300	[thread overview]
Message-ID: <20240502103618.129017-1-dmitrii.bundin.a@gmail.com> (raw)
In-Reply-To: <20240413031747.2416581-1-dmitrii.bundin.a@gmail.com>

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


      reply	other threads:[~2024-05-02 10:36 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
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 [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20240502103618.129017-1-dmitrii.bundin.a@gmail.com \
    --to=dmitrii.bundin.a@gmail.com \
    --cc=airlied@gmail.com \
    --cc=bp@suse.de \
    --cc=daniel@ffwll.ch \
    --cc=dri-devel@lists.freedesktop.org \
    --cc=gongruiqi1@huawei.com \
    --cc=intel-gfx@lists.freedesktop.org \
    --cc=jani.nikula@linux.intel.com \
    --cc=joonas.lahtinen@linux.intel.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=michal.wajdeczko@intel.com \
    --cc=rdunlap@infradead.org \
    --cc=rodrigo.vivi@intel.com \
    --cc=tursulin@ursulin.net \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).