[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <YqdiwVQE9jzf++jQ@iweiny-desk3>
Date: Mon, 13 Jun 2022 09:16:01 -0700
From: Ira Weiny <ira.weiny@...el.com>
To: Christophe Leroy <christophe.leroy@...roup.eu>
CC: "linux-api@...r.kernel.org" <linux-api@...r.kernel.org>,
"x86@...nel.org" <x86@...nel.org>,
"Aneesh Kumar K . V" <aneesh.kumar@...ux.ibm.com>,
"Dave Hansen" <dave.hansen@...ux.intel.com>,
"linuxppc-dev@...ts.ozlabs.org" <linuxppc-dev@...ts.ozlabs.org>,
"linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>,
"linux-mm@...ck.org" <linux-mm@...ck.org>,
"linux-kselftest@...r.kernel.org" <linux-kselftest@...r.kernel.org>,
"Sohil Mehta" <sohil.mehta@...el.com>
Subject: Re: [RFC PATCH 6/6] pkeys: Change mm_pkey_free() to void
On Mon, Jun 13, 2022 at 09:17:06AM +0000, Christophe Leroy wrote:
>
>
> Le 11/06/2022 à 01:35, ira.weiny@...el.com a écrit :
> > From: Ira Weiny <ira.weiny@...el.com>
> >
> > Now that the pkey arch support is no longer checked in mm_pkey_free()
> > there is no reason to have it return int.
>
> Right, I see this is doing what I commented in previous patch.
Yes because it was suggested by Sohil I decided to make it a separate patch to
make the credit easier.
> > diff --git a/mm/mprotect.c b/mm/mprotect.c
> > index 41458e729c27..e872bdd2e228 100644
> > --- a/mm/mprotect.c
> > +++ b/mm/mprotect.c
> > @@ -809,8 +809,10 @@ SYSCALL_DEFINE1(pkey_free, int, pkey)
> > return ret;
> >
> > mmap_write_lock(current->mm);
> > - if (mm_pkey_is_allocated(current->mm, pkey))
> > - ret = mm_pkey_free(current->mm, pkey);
> > + if (mm_pkey_is_allocated(current->mm, pkey)) {
> > + mm_pkey_free(current->mm, pkey);
> > + ret = 0;
> > + }
>
> Or you could have ret = 0 by default and do
>
> if (mm_pkey_is_allocated(current->mm, pkey))
> mm_pkey_free(current->mm, pkey);
> else
> ret = -EINVAL;
Yes that fits the kernel style better.
Thanks for the review!
Ira
>
> > mmap_write_unlock(current->mm);
> >
> > /*
Powered by blists - more mailing lists