Re: [PATCH] ubsan: disable UBSAN_DIV_ZERO for clang

From: Linus Torvalds
Date: Thu Jul 14 2022 - 17:49:15 EST


On Thu, Jul 14, 2022 at 2:38 PM Nick Desaulniers
<ndesaulniers@xxxxxxxxxx> wrote:
>
> int do_div (int dividend, int divisor) {
> return dividend / divisor;
> }
>
> has UB should divisor ever be zero, not much different from:

So?

What about the million other '/' in the kernel?

Adding one check to 'do_div()' is just stupid. It's like using a
bottle-cap as an umbrella.

Nick, that's the whole _point_ of having compiler support for things
like this - automation. Because doing them manually one at a time is
just completely broken and stupid.

Linus