Skip to content

Commit

Permalink
MIPS: Fix new sparse warnings
Browse files Browse the repository at this point in the history
Commit 45deb5f ("MIPS: uaccess: Remove get_fs/set_fs call sites")
caused a few new sparse warnings, fix them.

Signed-off-by: Thomas Bogendoerfer <tsbogend@alpha.franken.de>
  • Loading branch information
Thomas Bogendoerfer committed Apr 7, 2021
1 parent 7f028bf commit 7cba412
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 6 deletions.
7 changes: 4 additions & 3 deletions arch/mips/kernel/access-helper.h
Original file line number Diff line number Diff line change
Expand Up @@ -4,15 +4,16 @@

static inline int __get_addr(unsigned long *a, unsigned long *p, bool user)
{
return user ? get_user(*a, p) : get_kernel_nofault(*a, p);
return user ? get_user(*a, (unsigned long __user *)p) :
get_kernel_nofault(*a, p);
}

static inline int __get_inst16(u16 *i, u16 *p, bool user)
{
return user ? get_user(*i, p) : get_kernel_nofault(*i, p);
return user ? get_user(*i, (u16 __user *)p) : get_kernel_nofault(*i, p);
}

static inline int __get_inst32(u32 *i, u32 *p, bool user)
{
return user ? get_user(*i, p) : get_kernel_nofault(*i, p);
return user ? get_user(*i, (u32 __user *)p) : get_kernel_nofault(*i, p);
}
6 changes: 3 additions & 3 deletions arch/mips/kernel/unaligned.c
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,7 @@ static u32 unaligned_action;
extern void show_registers(struct pt_regs *regs);

static void emulate_load_store_insn(struct pt_regs *regs,
void __user *addr, unsigned int __user *pc)
void __user *addr, unsigned int *pc)
{
unsigned long origpc, orig31, value;
union mips_instruction insn;
Expand Down Expand Up @@ -1475,7 +1475,7 @@ static void emulate_load_store_MIPS16e(struct pt_regs *regs, void __user * addr)
asmlinkage void do_ade(struct pt_regs *regs)
{
enum ctx_state prev_state;
unsigned int __user *pc;
unsigned int *pc;

prev_state = exception_enter();
perf_sw_event(PERF_COUNT_SW_ALIGNMENT_FAULTS,
Expand Down Expand Up @@ -1526,7 +1526,7 @@ asmlinkage void do_ade(struct pt_regs *regs)

if (unaligned_action == UNALIGNED_ACTION_SHOW)
show_registers(regs);
pc = (unsigned int __user *)exception_epc(regs);
pc = (unsigned int *)exception_epc(regs);

emulate_load_store_insn(regs, (void __user *)regs->cp0_badvaddr, pc);

Expand Down

0 comments on commit 7cba412

Please sign in to comment.