[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CAHk-=wgYPBhMvCJHFVo=dr=2RhVxKwEf+SLQEBVhANoY_bUk2A@mail.gmail.com>
Date: Mon, 20 Jan 2025 11:14:41 -0800
From: Linus Torvalds <torvalds@...ux-foundation.org>
To: Andy Shevchenko <andriy.shevchenko@...ux.intel.com>
Cc: David Laight <david.laight.linux@...il.com>, Guenter Roeck <linux@...ck-us.net>,
Jani Nikula <jani.nikula@...ux.intel.com>, David Laight <David.Laight@...lab.com>,
Arnd Bergmann <arnd@...nel.org>,
"linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>, Jens Axboe <axboe@...nel.dk>,
Matthew Wilcox <willy@...radead.org>, Christoph Hellwig <hch@...radead.org>,
Andrew Morton <akpm@...ux-foundation.org>, Dan Carpenter <dan.carpenter@...aro.org>,
"Jason A . Donenfeld" <Jason@...c4.com>, "pedro.falcato@...il.com" <pedro.falcato@...il.com>,
Mateusz Guzik <mjguzik@...il.com>, "linux-mm@...ck.org" <linux-mm@...ck.org>,
Lorenzo Stoakes <lorenzo.stoakes@...cle.com>, intel-xe@...ts.freedesktop.org,
intel-gfx@...ts.freedesktop.org, David Airlie <airlied@...il.com>,
Simona Vetter <simona@...ll.ch>, Rodrigo Vivi <rodrigo.vivi@...el.com>
Subject: Re: Buiild error in i915/xe
On Mon, 20 Jan 2025 at 10:55, Andy Shevchenko
<andriy.shevchenko@...ux.intel.com> wrote:
>
> Excuse me if I am missing something, but clamp() has a warning inside it, correct?
> Why do we need an additional warning on top of that?
Note: the warning in clamp() only finds compile-time obvious wrong uses.
It's really meant to notice the trivial case where you clam with
constants and just got the order wrong, so you do something silly like
res = clamp(in, 15, 1);
but it does also end up catching slightly more complex things where
the compiler can figure out the range of the clamping.
The build problem then comes from the compiler doing various *other*
code movem,ent and optimization too, and - like in this case - finds
an error path where the clamping is done "wrong".
I think the real issue in the i915 driver is that it does that
WARN_ON(), but then it just happily continues anyway.
So if the i915 driver instead did
if (WARN_ON(..)) return invalid value;
none of this would ever have happened.
Linus
Powered by blists - more mailing lists