[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CAHk-=wgTSdKYbmB1JYM5vmHMcD9J9UZr0mn7BOYM_LudrP+Xvw@mail.gmail.com>
Date: Fri, 17 Mar 2023 13:51:17 -0700
From: Linus Torvalds <torvalds@...ux-foundation.org>
To: Miguel Ojeda <miguel.ojeda.sandonis@...il.com>
Cc: Kees Cook <keescook@...omium.org>,
Nick Desaulniers <ndesaulniers@...gle.com>,
Jens Axboe <axboe@...nel.dk>,
Nathan Chancellor <nathan@...nel.org>,
"linux-block@...r.kernel.org" <linux-block@...r.kernel.org>,
clang-built-linux <llvm@...ts.linux.dev>,
linux-hardening@...r.kernel.org
Subject: Re: [GIT PULL] Block fixes for 6.3-rc3
On Fri, Mar 17, 2023 at 1:42 PM Miguel Ojeda
<miguel.ojeda.sandonis@...il.com> wrote:
>
> It is comparing against just the `.code` in the `m5mols_default_ffmt`
> table, i.e. the `MEDIA_BUS_FMT_VYUY8_2X8` (8199 = 0x2007) and
> `MEDIA_BUS_FMT_JPEG_1X8` (16385 = 0x4001), see
Yeah, I see what it's doing.
But:
> If the condition had `++type` instead, it would not be a problem,
> because the loop stops before we go into the out of bounds access thus
> no UB.
Yeah, but clang really should have generated a proper third iteration,
which calls that "out of bounds" case, and then returns, instead fo
falling off the end.
I do think that on the kernel side, the fix is to just change
} while (type++ != SIZE_DEFAULT_FFMT);
to
} while (++type != SIZE_DEFAULT_FFMT);
but I would *really* like clang to be fixed to not silently generate
code that does insane things and would be basically impossible to
debug if it ever triggers.
We would have spent a *lot* of time wondering how the heck we Oopsed
in m5mols_get_frame_desc().
Linus
Powered by blists - more mailing lists