Re: [RFC PATCH 3/3] x86/mm: cleanup prctl_enable_tagged_addr() nr_bits error checking

From: Yosry Ahmed
Date: Thu Mar 07 2024 - 15:28:04 EST


On Thu, Mar 07, 2024 at 07:31:44PM +0200, Kirill A. Shutemov wrote:
> On Thu, Mar 07, 2024 at 01:39:16PM +0000, Yosry Ahmed wrote:
> > In prctl_enable_tagged_addr(), we check that nr_bits is in the correct
> > range, but we do so in a twisted if/else block where the correct case is
> > sandwiched between two error cases doing exactly the same thing.
> >
> > Simplify the if condition and pull the correct case outside with the
> > rest of the success code path.
>
> I'm okay either way.
>
> I structured the code this way as I had separate patch that adds also
> LAM_U48. But it is unlikely to get upstreamed.

I see, thanks for the context. For now, I think this makes the code a
little bit clearer.