All of lore.kernel.org
 help / color / mirror / Atom feed
From: Mauro Carvalho Chehab <mchehab@kernel.org>
To: Linus Torvalds <torvalds@linux-foundation.org>
Cc: Miguel Ojeda <miguel.ojeda.sandonis@gmail.com>,
	Kees Cook <keescook@chromium.org>,
	Nick Desaulniers <ndesaulniers@google.com>,
	Jens Axboe <axboe@kernel.dk>,
	Nathan Chancellor <nathan@kernel.org>,
	"linux-block@vger.kernel.org" <linux-block@vger.kernel.org>,
	clang-built-linux <llvm@lists.linux.dev>,
	linux-hardening@vger.kernel.org,
	Sylwester Nawrocki <s.nawrocki@samsung.com>,
	Marek Szyprowski <m.szyprowski@samsung.com>,
	Sakari Ailus <sakari.ailus@linux.intel.com>,
	linux-media@vger.kernel.org
Subject: Re: [GIT PULL] Block fixes for 6.3-rc3
Date: Sun, 19 Mar 2023 01:48:12 +0100	[thread overview]
Message-ID: <20230319014812.2ef3c995@coco.lan> (raw)
In-Reply-To: <CAHk-=wgTSdKYbmB1JYM5vmHMcD9J9UZr0mn7BOYM_LudrP+Xvw@mail.gmail.com>

Em Fri, 17 Mar 2023 13:51:17 -0700
Linus Torvalds <torvalds@linux-foundation.org> escreveu:

> On Fri, Mar 17, 2023 at 1:42 PM Miguel Ojeda
> <miguel.ojeda.sandonis@gmail.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);

Yeah, that seems to be the right fix to me too.

Ack on such change: 
https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/patch/?id=efbcbb12ee99f750c9f25c873b55ad774871de2a

Regards,
Mauro


> 
> 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
> 



Thanks,
Mauro

  parent reply	other threads:[~2023-03-19  0:48 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-03-17 17:16 [GIT PULL] Block fixes for 6.3-rc3 Jens Axboe
2023-03-17 18:35 ` Linus Torvalds
2023-03-17 18:50   ` Linus Torvalds
2023-03-17 20:31     ` Miguel Ojeda
2023-03-17 20:45       ` Linus Torvalds
2023-03-17 18:59   ` Nick Desaulniers
2023-03-17 19:50     ` Kees Cook
2023-03-17 20:30       ` Linus Torvalds
2023-03-17 20:42         ` Miguel Ojeda
2023-03-17 20:51           ` Linus Torvalds
2023-03-17 21:00             ` Linus Torvalds
2023-03-17 22:56               ` Nick Desaulniers
2023-03-17 21:01             ` Miguel Ojeda
2023-03-18 18:20             ` Linus Torvalds
2023-03-19  0:48             ` Mauro Carvalho Chehab [this message]
2023-03-17 20:35       ` Nick Desaulniers
2023-03-17 19:44   ` Jens Axboe
2023-03-17 18:52 ` pr-tracker-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=20230319014812.2ef3c995@coco.lan \
    --to=mchehab@kernel.org \
    --cc=axboe@kernel.dk \
    --cc=keescook@chromium.org \
    --cc=linux-block@vger.kernel.org \
    --cc=linux-hardening@vger.kernel.org \
    --cc=linux-media@vger.kernel.org \
    --cc=llvm@lists.linux.dev \
    --cc=m.szyprowski@samsung.com \
    --cc=miguel.ojeda.sandonis@gmail.com \
    --cc=nathan@kernel.org \
    --cc=ndesaulniers@google.com \
    --cc=s.nawrocki@samsung.com \
    --cc=sakari.ailus@linux.intel.com \
    --cc=torvalds@linux-foundation.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.