Re: [PATCH] iommu: Convert unreachable() to BUG()

From: Josh Poimboeuf
Date: Tue Apr 01 2025 - 20:50:54 EST


On Thu, Mar 27, 2025 at 01:37:18PM +0100, Peter Zijlstra wrote:
> On Wed, Mar 26, 2025 at 10:28:46PM -0700, Josh Poimboeuf wrote:
> > Bare unreachable() should be avoided as it generates undefined behavior,
> > e.g. falling through to the next function. Use BUG() instead so the
> > error is defined.
>
> Right; I did a pass like this a while ago and thought I'd removed all
> unreachable() abuse.

Any reason not to just "#define unreachable() BUG()" and convert UD2 and
similar to use __builtin_unreachable()?

--
Josh