[PATCH v3 08/13] um: nommu: configure fs register on host syscall invocation

Geert Uytterhoeven geert at linux-m68k.org
Wed Dec 4 11:31:11 PST 2024


On Wed, Dec 4, 2024 at 5:53 PM Johannes Berg <johannes at sipsolutions.net> wrote:
> On Tue, 2024-12-03 at 13:23 +0900, Hajime Tazaki wrote:
> >
> > +static int os_x86_arch_prctl(int pid, int option, unsigned long *arg2)
> > +{
> > +     if (host_has_fsgsbase) {
> > +             switch (option) {
> > +             case ARCH_SET_FS:
> > +                     wrfsbase(*arg2);
> > +                     break;
> > +             case ARCH_SET_GS:
> > +                     wrgsbase(*arg2);
> > +                     break;
> > +             case ARCH_GET_FS:
> > +                     *arg2 = rdfsbase();
> > +                     break;
> > +             case ARCH_GET_GS:
> > +                     *arg2 = rdgsbase();
> > +                     break;
> > +             }
> > +             return 0;
> > +     } else {
>
> Even checkpatch complains about else after return :) No need.

And inverting the check would reduce indentation in the largest
branch (the smallest branch is just "return os_arch_prctl(...)".

Gr{oetje,eeting}s,

                        Geert

-- 
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert at linux-m68k.org

In personal conversations with technical people, I call myself a hacker. But
when I'm talking to journalists I just say "programmer" or something like that.
                                -- Linus Torvalds



More information about the linux-um mailing list