From: Kees Cook <kees@kernel.org>
To: Jani Nikula <jani.nikula@intel.com>
Cc: "Gustavo A. R. Silva" <gustavoars@kernel.org>,
linux-hardening@vger.kernel.org, intel-gfx@lists.freedesktop.org
Subject: Re: i915 utils: range_overflows*()
Date: Mon, 2 Jun 2025 11:20:51 -0700 [thread overview]
Message-ID: <202506021119.8FD6339F@keescook> (raw)
In-Reply-To: <d127e624d6a851f488c60631a9bf84f6316748eb@intel.com>
On Mon, Jun 02, 2025 at 04:10:21PM +0300, Jani Nikula wrote:
> On Fri, 30 May 2025, Kees Cook <kees@kernel.org> wrote:
> > On Fri, May 30, 2025 at 10:44:31AM +0300, Jani Nikula wrote:
> >>
> >> Hi Kees -
> >>
> >> drivers/gpu/drm/i915/i915_utils.h has a handful of helper macros for
> >> checking range overflows: range_overflows(), range_overflows_t(),
> >> range_overflows_end(), and range_overflows_end_t().
> >>
> >> Looks like the first one has also been copy-pasted to
> >> include/drm/drm_buddy.h.
> >>
> >> Feels like include/linux/overflow.h would be the right place for (some
> >> version of) them.
> >>
> >> Thoughts?
> >
> > Sure, yes! They need some documentation too. :) And probably some
> > renaming. It looks like range_overflows() is not end-inclusive, but
> > range_overflows_end() is? And the _t variants are forcing explicit
> > types (like max_t, but unlike struct_size_t).
>
> Ah, naming.
>
> As we all know, NP in NP-complete actually stands for "naming
> problem". It's hard to come up with a good name, but presented with one,
> it's quick to verify it is indeed good.
>
> Ideas for the hard part?
Well, since the users already exist with the current names, how about we
skip that for now and just relocate these (with added kern-doc) to
overflow.h and go from there?
-Kees
--
Kees Cook
next prev parent reply other threads:[~2025-06-02 18:21 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-05-30 7:44 i915 utils: range_overflows*() Jani Nikula
2025-05-30 17:28 ` Kees Cook
2025-06-02 13:10 ` Jani Nikula
2025-06-02 18:20 ` Kees Cook [this message]
2025-06-04 8:59 ` [RFC] drm/i915/utils: document range_overflows*() macros Jani Nikula
2025-06-04 9:25 ` ✗ Fi.CI.CHECKPATCH: warning for " Patchwork
2025-06-04 9:25 ` ✗ Fi.CI.SPARSE: " Patchwork
2025-06-04 9:49 ` ✓ i915.CI.BAT: success " Patchwork
2025-06-04 11:23 ` ✗ i915.CI.Full: failure " Patchwork
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=202506021119.8FD6339F@keescook \
--to=kees@kernel.org \
--cc=gustavoars@kernel.org \
--cc=intel-gfx@lists.freedesktop.org \
--cc=jani.nikula@intel.com \
--cc=linux-hardening@vger.kernel.org \
/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