From: Sebastian Brzezinka <sebastian.brzezinka@intel.com>
To: Andi Shyti <andi.shyti@kernel.org>,
Janusz Krzysztofik <janusz.krzysztofik@linux.intel.com>
Cc: Andi Shyti <andi.shyti@linux.intel.com>,
<intel-gfx@lists.freedesktop.org>,
<dri-devel@lists.freedesktop.org>,
"Jani Nikula" <jani.nikula@linux.intel.com>,
Joonas Lahtinen <joonas.lahtinen@linux.intel.com>,
Rodrigo Vivi <rodrigo.vivi@intel.com>,
Tvrtko Ursulin <tursulin@ursulin.net>,
Andrew Morton <akpm@linux-foundation.org>,
"Matthew Wilcox (Oracle)" <willy@infradead.org>,
Krzysztof Karas <krzysztof.karas@intel.com>,
Sebastian Brzezinka <sebastian.brzezinka@intel.com>,
Krzysztof Niemiec <krzysztof.niemiec@intel.com>
Subject: Re: [PATCH] drm/i915: Fix potential overflow of shmem scatterlist length
Date: Thu, 26 Feb 2026 14:02:00 +0100 [thread overview]
Message-ID: <DGOWW6DBLKYH.KA9WWZ0R3SGK@intel.com> (raw)
In-Reply-To: <aaA677ZYYWJptOqz@zenone.zhora.eu>
On Thu Feb 26, 2026 at 1:23 PM CET, Andi Shyti wrote:
> On Wed, Feb 25, 2026 at 06:29:12PM +0100, Janusz Krzysztofik wrote:
>> On Wednesday, 25 February 2026 16:38:18 CET Andi Shyti wrote:
>> > > > For clarity this can be written as
>> > > >
>> > > > nr_pages = min_t(unsigned long,
>> > > > folio_nr_pages(folio), page_count - i);
>> > > > nr_pages = min_t(unsigned long, nr_pages, max_pages);
>> > >
>> > > Do you think the min_array() is less clear? Let's see what others say.
>> >
>> > min_array() is clear, it's the ((unsigned long[]) { ... }) that
>> > iis nice and fancy but of difficult first read. But, as I said,
>> > it can stay, I don't have a strong opinion, maybe I'd have done
>> > the same.
>>
>> Would you be more happy with a locally declared unsigned long table,
>> initalized with those 3 values, nr_pages - i and max_segment << PAGE_SHIFT
>> statically, folio_nr_pages(folio) once folio is ready, then passed to
>> min_array()?
>
> mine was only an idea, I'm fine with what it is now if no one has
> anything against it. Perhaps, just a little comment could help
> understand why we are evaluating out of three elements (but we
> are talking trivial details here :) ).
>
> Thanks,
> Andi
There’s also a min3 function, but you’d need to cast the
variables, so using an array is ok in my opinion.
Best regards,
Sebastian
next prev parent reply other threads:[~2026-02-26 13:01 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-02-24 9:49 [PATCH] drm/i915: Fix potential overflow of shmem scatterlist length Janusz Krzysztofik
2026-02-25 14:41 ` Andi Shyti
2026-02-25 15:11 ` Janusz Krzysztofik
2026-02-25 15:38 ` Andi Shyti
2026-02-25 17:29 ` Janusz Krzysztofik
2026-02-26 12:23 ` Andi Shyti
2026-02-26 13:02 ` Sebastian Brzezinka [this message]
2026-02-27 5:21 ` Claude review: " Claude Code Review Bot
2026-02-27 5:21 ` Claude Code Review Bot
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=DGOWW6DBLKYH.KA9WWZ0R3SGK@intel.com \
--to=sebastian.brzezinka@intel.com \
--cc=akpm@linux-foundation.org \
--cc=andi.shyti@kernel.org \
--cc=andi.shyti@linux.intel.com \
--cc=dri-devel@lists.freedesktop.org \
--cc=intel-gfx@lists.freedesktop.org \
--cc=jani.nikula@linux.intel.com \
--cc=janusz.krzysztofik@linux.intel.com \
--cc=joonas.lahtinen@linux.intel.com \
--cc=krzysztof.karas@intel.com \
--cc=krzysztof.niemiec@intel.com \
--cc=rodrigo.vivi@intel.com \
--cc=tursulin@ursulin.net \
--cc=willy@infradead.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