From: ira.weiny@intel.com To: linux-api@vger.kernel.org Cc: Ira Weiny <ira.weiny@intel.com>, Dave Hansen <dave.hansen@linux.intel.com>, "Aneesh Kumar K . V" <aneesh.kumar@linux.ibm.com>, Sohil Mehta <sohil.mehta@intel.com>, x86@kernel.org, linuxppc-dev@lists.ozlabs.org, linux-kernel@vger.kernel.org, linux-mm@kvack.org, linux-kselftest@vger.kernel.org Subject: [RFC PATCH 6/6] pkeys: Change mm_pkey_free() to void Date: Fri, 10 Jun 2022 16:35:33 -0700 [thread overview] Message-ID: <20220610233533.3649584-7-ira.weiny@intel.com> (raw) In-Reply-To: <20220610233533.3649584-1-ira.weiny@intel.com> From: Ira Weiny <ira.weiny@intel.com> Now that the pkey arch support is no longer checked in mm_pkey_free() there is no reason to have it return int. Change the return value to void. Cc: Dave Hansen <dave.hansen@linux.intel.com> Cc: Aneesh Kumar K.V <aneesh.kumar@linux.ibm.com> Suggested-by: Sohil Mehta <sohil.mehta@intel.com> Signed-off-by: Ira Weiny <ira.weiny@intel.com> --- arch/powerpc/include/asm/pkeys.h | 4 +--- arch/x86/include/asm/pkeys.h | 4 +--- include/linux/pkeys.h | 5 +---- mm/mprotect.c | 6 ++++-- 4 files changed, 7 insertions(+), 12 deletions(-) diff --git a/arch/powerpc/include/asm/pkeys.h b/arch/powerpc/include/asm/pkeys.h index e96aa91f817b..4d01a48ab941 100644 --- a/arch/powerpc/include/asm/pkeys.h +++ b/arch/powerpc/include/asm/pkeys.h @@ -105,11 +105,9 @@ static inline int mm_pkey_alloc(struct mm_struct *mm) return ret; } -static inline int mm_pkey_free(struct mm_struct *mm, int pkey) +static inline void mm_pkey_free(struct mm_struct *mm, int pkey) { __mm_pkey_free(mm, pkey); - - return 0; } /* diff --git a/arch/x86/include/asm/pkeys.h b/arch/x86/include/asm/pkeys.h index da02737cc4d1..1f408f46fa9a 100644 --- a/arch/x86/include/asm/pkeys.h +++ b/arch/x86/include/asm/pkeys.h @@ -105,11 +105,9 @@ int mm_pkey_alloc(struct mm_struct *mm) } static inline -int mm_pkey_free(struct mm_struct *mm, int pkey) +void mm_pkey_free(struct mm_struct *mm, int pkey) { mm_set_pkey_free(mm, pkey); - - return 0; } static inline int vma_pkey(struct vm_area_struct *vma) diff --git a/include/linux/pkeys.h b/include/linux/pkeys.h index 86be8bf27b41..bf98c50a3437 100644 --- a/include/linux/pkeys.h +++ b/include/linux/pkeys.h @@ -30,10 +30,7 @@ static inline int mm_pkey_alloc(struct mm_struct *mm) return -1; } -static inline int mm_pkey_free(struct mm_struct *mm, int pkey) -{ - return -EINVAL; -} +static inline void mm_pkey_free(struct mm_struct *mm, int pkey) { } static inline int arch_set_user_pkey_access(struct task_struct *tsk, int pkey, unsigned long init_val) 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; + } mmap_write_unlock(current->mm); /* -- 2.35.1
WARNING: multiple messages have this Message-ID (diff)
From: ira.weiny@intel.com To: linux-api@vger.kernel.org Cc: x86@kernel.org, "Aneesh Kumar K . V" <aneesh.kumar@linux.ibm.com>, Dave Hansen <dave.hansen@linux.intel.com>, linuxppc-dev@lists.ozlabs.org, linux-kernel@vger.kernel.org, linux-mm@kvack.org, linux-kselftest@vger.kernel.org, Sohil Mehta <sohil.mehta@intel.com>, Ira Weiny <ira.weiny@intel.com> Subject: [RFC PATCH 6/6] pkeys: Change mm_pkey_free() to void Date: Fri, 10 Jun 2022 16:35:33 -0700 [thread overview] Message-ID: <20220610233533.3649584-7-ira.weiny@intel.com> (raw) In-Reply-To: <20220610233533.3649584-1-ira.weiny@intel.com> From: Ira Weiny <ira.weiny@intel.com> Now that the pkey arch support is no longer checked in mm_pkey_free() there is no reason to have it return int. Change the return value to void. Cc: Dave Hansen <dave.hansen@linux.intel.com> Cc: Aneesh Kumar K.V <aneesh.kumar@linux.ibm.com> Suggested-by: Sohil Mehta <sohil.mehta@intel.com> Signed-off-by: Ira Weiny <ira.weiny@intel.com> --- arch/powerpc/include/asm/pkeys.h | 4 +--- arch/x86/include/asm/pkeys.h | 4 +--- include/linux/pkeys.h | 5 +---- mm/mprotect.c | 6 ++++-- 4 files changed, 7 insertions(+), 12 deletions(-) diff --git a/arch/powerpc/include/asm/pkeys.h b/arch/powerpc/include/asm/pkeys.h index e96aa91f817b..4d01a48ab941 100644 --- a/arch/powerpc/include/asm/pkeys.h +++ b/arch/powerpc/include/asm/pkeys.h @@ -105,11 +105,9 @@ static inline int mm_pkey_alloc(struct mm_struct *mm) return ret; } -static inline int mm_pkey_free(struct mm_struct *mm, int pkey) +static inline void mm_pkey_free(struct mm_struct *mm, int pkey) { __mm_pkey_free(mm, pkey); - - return 0; } /* diff --git a/arch/x86/include/asm/pkeys.h b/arch/x86/include/asm/pkeys.h index da02737cc4d1..1f408f46fa9a 100644 --- a/arch/x86/include/asm/pkeys.h +++ b/arch/x86/include/asm/pkeys.h @@ -105,11 +105,9 @@ int mm_pkey_alloc(struct mm_struct *mm) } static inline -int mm_pkey_free(struct mm_struct *mm, int pkey) +void mm_pkey_free(struct mm_struct *mm, int pkey) { mm_set_pkey_free(mm, pkey); - - return 0; } static inline int vma_pkey(struct vm_area_struct *vma) diff --git a/include/linux/pkeys.h b/include/linux/pkeys.h index 86be8bf27b41..bf98c50a3437 100644 --- a/include/linux/pkeys.h +++ b/include/linux/pkeys.h @@ -30,10 +30,7 @@ static inline int mm_pkey_alloc(struct mm_struct *mm) return -1; } -static inline int mm_pkey_free(struct mm_struct *mm, int pkey) -{ - return -EINVAL; -} +static inline void mm_pkey_free(struct mm_struct *mm, int pkey) { } static inline int arch_set_user_pkey_access(struct task_struct *tsk, int pkey, unsigned long init_val) 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; + } mmap_write_unlock(current->mm); /* -- 2.35.1
next prev parent reply other threads:[~2022-06-10 23:36 UTC|newest] Thread overview: 36+ messages / expand[flat|nested] mbox.gz Atom feed top 2022-06-10 23:35 [RFC PATCH 0/6] User pkey minor bug fixes ira.weiny 2022-06-10 23:35 ` ira.weiny 2022-06-10 23:35 ` [RFC PATCH 1/6] testing/pkeys: Add command line options ira.weiny 2022-06-10 23:35 ` ira.weiny 2022-06-13 22:31 ` Sohil Mehta 2022-06-13 22:31 ` Sohil Mehta 2022-06-13 23:41 ` Ira Weiny 2022-06-13 23:41 ` Ira Weiny 2022-06-10 23:35 ` [RFC PATCH 2/6] testing/pkeys: Don't use uninitialized variable ira.weiny 2022-06-10 23:35 ` ira.weiny 2022-06-13 22:48 ` Sohil Mehta 2022-06-13 22:48 ` Sohil Mehta 2022-06-13 23:59 ` Ira Weiny 2022-06-13 23:59 ` Ira Weiny 2022-06-10 23:35 ` [RFC PATCH 3/6] testing/pkeys: Add additional test for pkey_alloc() ira.weiny 2022-06-10 23:35 ` ira.weiny 2022-06-16 19:25 ` Sohil Mehta 2022-06-16 19:25 ` Sohil Mehta 2022-06-16 20:24 ` Dave Hansen 2022-06-16 20:24 ` Dave Hansen 2022-06-10 23:35 ` [RFC PATCH 4/6] pkeys: Lift pkey hardware check " ira.weiny 2022-06-10 23:35 ` ira.weiny 2022-06-16 19:31 ` Sohil Mehta 2022-06-16 19:31 ` Sohil Mehta 2022-06-10 23:35 ` [RFC PATCH 5/6] pkeys: Up level pkey_free() checks ira.weiny 2022-06-10 23:35 ` ira.weiny 2022-06-13 9:14 ` Christophe Leroy 2022-06-13 9:14 ` Christophe Leroy 2022-06-10 23:35 ` ira.weiny [this message] 2022-06-10 23:35 ` [RFC PATCH 6/6] pkeys: Change mm_pkey_free() to void ira.weiny 2022-06-13 9:17 ` Christophe Leroy 2022-06-13 9:17 ` Christophe Leroy 2022-06-13 16:16 ` Ira Weiny 2022-06-13 16:16 ` Ira Weiny 2022-06-13 22:05 ` [RFC PATCH 0/6] User pkey minor bug fixes Sohil Mehta 2022-06-13 22:05 ` Sohil Mehta
Reply instructions: You may reply publicly to this message via plain-text email using any one of the following methods: * Save the following mbox file, import it into your mail client, and reply-to-all from there: mbox Avoid top-posting and favor interleaved quoting: https://en.wikipedia.org/wiki/Posting_style#Interleaved_style * Reply using the --to, --cc, and --in-reply-to switches of git-send-email(1): git send-email \ --in-reply-to=20220610233533.3649584-7-ira.weiny@intel.com \ --to=ira.weiny@intel.com \ --cc=aneesh.kumar@linux.ibm.com \ --cc=dave.hansen@linux.intel.com \ --cc=linux-api@vger.kernel.org \ --cc=linux-kernel@vger.kernel.org \ --cc=linux-kselftest@vger.kernel.org \ --cc=linux-mm@kvack.org \ --cc=linuxppc-dev@lists.ozlabs.org \ --cc=sohil.mehta@intel.com \ --cc=x86@kernel.org \ /path/to/YOUR_REPLY https://kernel.org/pub/software/scm/git/docs/git-send-email.html * If your mail client supports setting the In-Reply-To header via mailto: links, try the mailto: linkBe sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes, see mirroring instructions on how to clone and mirror all data and code used by this external index.