Commit 23fc539e authored by Arnd Bergmann's avatar Arnd Bergmann
Browse files

uaccess: fix type mismatch warnings from access_ok()



On some architectures, access_ok() does not do any argument type
checking, so replacing the definition with a generic one causes
a few warnings for harmless issues that were never caught before.

Fix the ones that I found either through my own test builds or
that were reported by the 0-day bot.

Reported-by: default avatarkernel test robot <lkp@intel.com>
Reviewed-by: default avatarChristoph Hellwig <hch@lst.de>
Acked-by: default avatarDinh Nguyen <dinguyen@kernel.org>
Signed-off-by: default avatarArnd Bergmann <arnd@arndb.de>
parent 52fe8d12
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -43,7 +43,7 @@ SYSCALL_DEFINE0(arc_gettls)
	return task_thread_info(current)->thr_ptr;
}

SYSCALL_DEFINE3(arc_usr_cmpxchg, int *, uaddr, int, expected, int, new)
SYSCALL_DEFINE3(arc_usr_cmpxchg, int __user *, uaddr, int, expected, int, new)
{
	struct pt_regs *regs = current_pt_regs();
	u32 uval;
+1 −1
Original line number Diff line number Diff line
@@ -195,7 +195,7 @@ static int swp_handler(struct pt_regs *regs, unsigned int instr)
		 destreg, EXTRACT_REG_NUM(instr, RT2_OFFSET), data);

	/* Check access in reasonable access range for both SWP and SWPB */
	if (!access_ok((address & ~3), 4)) {
	if (!access_ok((void __user *)(address & ~3), 4)) {
		pr_debug("SWP{B} emulation: access to %p not allowed!\n",
			 (void *)address);
		res = -EFAULT;
+1 −1
Original line number Diff line number Diff line
@@ -576,7 +576,7 @@ do_cache_op(unsigned long start, unsigned long end, int flags)
	if (end < start || flags)
		return -EINVAL;

	if (!access_ok(start, end - start))
	if (!access_ok((void __user *)start, end - start))
		return -EFAULT;

	return __do_cache_op(start, end);
+1 −1
Original line number Diff line number Diff line
@@ -49,7 +49,7 @@ static unsigned long user_backtrace(struct perf_callchain_entry_ctx *entry,
{
	struct stackframe buftail;
	unsigned long lr = 0;
	unsigned long *user_frame_tail = (unsigned long *)fp;
	unsigned long __user *user_frame_tail = (unsigned long __user *)fp;

	/* Check accessibility of one struct frame_tail beyond */
	if (!access_ok(user_frame_tail, sizeof(buftail)))
+1 −1
Original line number Diff line number Diff line
@@ -136,7 +136,7 @@ static inline void __user *get_sigframe(struct ksignal *ksig,
static int
setup_rt_frame(struct ksignal *ksig, sigset_t *set, struct pt_regs *regs)
{
	struct rt_sigframe *frame;
	struct rt_sigframe __user *frame;
	int err = 0;

	frame = get_sigframe(ksig, regs, sizeof(*frame));
Loading