Skip to content

Commit e3efbfb

Browse files
chleroymaddy-kerneldev
authored andcommitted
powerpc/uaccess: Remove unused size and from parameters from allow_access_user()
Since commit 1613252 ("powerpc/32s: Rework Kernel Userspace Access Protection") the size parameter is unused on all platforms. And the 'from' parameter has never been used. Remove them. Signed-off-by: Christophe Leroy <christophe.leroy@csgroup.eu> Signed-off-by: Madhavan Srinivasan <maddy@linux.ibm.com> Link: https://patch.msgid.link/4552b00707923b71150ee47b925d6eaae1b03261.1766574657.git.chleroy@kernel.org
1 parent 5fbc09e commit e3efbfb

5 files changed

Lines changed: 9 additions & 15 deletions

File tree

arch/powerpc/include/asm/book3s/32/kup.h

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -97,8 +97,7 @@ static __always_inline unsigned long __kuap_get_and_assert_locked(void)
9797
}
9898
#define __kuap_get_and_assert_locked __kuap_get_and_assert_locked
9999

100-
static __always_inline void allow_user_access(void __user *to, const void __user *from,
101-
u32 size, unsigned long dir)
100+
static __always_inline void allow_user_access(void __user *to, unsigned long dir)
102101
{
103102
BUILD_BUG_ON(!__builtin_constant_p(dir));
104103

arch/powerpc/include/asm/book3s/64/kup.h

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -353,8 +353,7 @@ __bad_kuap_fault(struct pt_regs *regs, unsigned long address, bool is_write)
353353
return (regs->amr & AMR_KUAP_BLOCK_READ) == AMR_KUAP_BLOCK_READ;
354354
}
355355

356-
static __always_inline void allow_user_access(void __user *to, const void __user *from,
357-
unsigned long size, unsigned long dir)
356+
static __always_inline void allow_user_access(void __user *to, unsigned long dir)
358357
{
359358
unsigned long thread_amr = 0;
360359

@@ -383,8 +382,7 @@ static __always_inline unsigned long get_kuap(void)
383382

384383
static __always_inline void set_kuap(unsigned long value) { }
385384

386-
static __always_inline void allow_user_access(void __user *to, const void __user *from,
387-
unsigned long size, unsigned long dir)
385+
static __always_inline void allow_user_access(void __user *to, unsigned long dir)
388386
{ }
389387

390388
#endif /* !CONFIG_PPC_KUAP */

arch/powerpc/include/asm/kup.h

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -72,8 +72,7 @@ static __always_inline void __kuap_kernel_restore(struct pt_regs *regs, unsigned
7272
* platforms.
7373
*/
7474
#ifndef CONFIG_PPC_BOOK3S_64
75-
static __always_inline void allow_user_access(void __user *to, const void __user *from,
76-
unsigned long size, unsigned long dir) { }
75+
static __always_inline void allow_user_access(void __user *to, unsigned long dir) { }
7776
static __always_inline void prevent_user_access(unsigned long dir) { }
7877
static __always_inline unsigned long prevent_user_access_return(void) { return 0UL; }
7978
static __always_inline void restore_user_access(unsigned long flags) { }
@@ -134,18 +133,18 @@ static __always_inline void kuap_assert_locked(void)
134133

135134
static __always_inline void allow_read_from_user(const void __user *from, unsigned long size)
136135
{
137-
allow_user_access(NULL, from, size, KUAP_READ);
136+
allow_user_access(NULL, KUAP_READ);
138137
}
139138

140139
static __always_inline void allow_write_to_user(void __user *to, unsigned long size)
141140
{
142-
allow_user_access(to, NULL, size, KUAP_WRITE);
141+
allow_user_access(to, KUAP_WRITE);
143142
}
144143

145144
static __always_inline void allow_read_write_user(void __user *to, const void __user *from,
146145
unsigned long size)
147146
{
148-
allow_user_access(to, from, size, KUAP_READ_WRITE);
147+
allow_user_access(to, KUAP_READ_WRITE);
149148
}
150149

151150
static __always_inline void prevent_read_from_user(const void __user *from, unsigned long size)

arch/powerpc/include/asm/nohash/32/kup-8xx.h

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -49,8 +49,7 @@ static __always_inline void uaccess_end_8xx(void)
4949
"i"(SPRN_MD_AP), "r"(MD_APG_KUAP), "i"(MMU_FTR_KUAP) : "memory");
5050
}
5151

52-
static __always_inline void allow_user_access(void __user *to, const void __user *from,
53-
unsigned long size, unsigned long dir)
52+
static __always_inline void allow_user_access(void __user *to, unsigned long dir)
5453
{
5554
uaccess_begin_8xx(MD_APG_INIT);
5655
}

arch/powerpc/include/asm/nohash/kup-booke.h

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -73,8 +73,7 @@ static __always_inline void uaccess_end_booke(void)
7373
"i"(SPRN_PID), "r"(0), "i"(MMU_FTR_KUAP) : "memory");
7474
}
7575

76-
static __always_inline void allow_user_access(void __user *to, const void __user *from,
77-
unsigned long size, unsigned long dir)
76+
static __always_inline void allow_user_access(void __user *to, unsigned long dir)
7877
{
7978
uaccess_begin_booke(current->thread.pid);
8079
}

0 commit comments

Comments
 (0)