Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 445a58ce authored by Paul Burton's avatar Paul Burton Committed by Ralf Baechle
Browse files

MIPS: math-emu: Correct user fault_addr type



The fault_addr argument to fpu_emulator_cop1Handler(), fpux_emu() and
cop1Emulate() has up until now been declared as:

  void *__user *fault_addr

This is essentially a pointer in user memory which points to a pointer
to void. This is not the intent for our code, which is actually
operating on a pointer to a pointer to void where the pointer to void is
pointing at user memory. ie. the pointer is in kernel memory & points to
user memory.

This mismatch produces a lot of sparse warnings that look like this:

arch/mips/math-emu/cp1emu.c:1485:45:
   warning: incorrect type in assignment (different address spaces)
      expected void *[noderef] <asn:1><noident>
      got unsigned int [noderef] [usertype] <asn:1>*[assigned] va

Fix these by modifying the declaration of the fault_addr argument to:

  void __user **fault_addr

Signed-off-by: default avatarPaul Burton <paul.burton@imgtec.com>
Cc: linux-mips@linux-mips.org
Cc: trivial@kernel.org
Patchwork: https://patchwork.linux-mips.org/patch/17173/


Signed-off-by: default avatarRalf Baechle <ralf@linux-mips.org>
parent 2aa7687c
Loading
Loading
Loading
Loading
+1 −1
Original line number Original line Diff line number Diff line
@@ -62,7 +62,7 @@ do { \


extern int fpu_emulator_cop1Handler(struct pt_regs *xcp,
extern int fpu_emulator_cop1Handler(struct pt_regs *xcp,
				    struct mips_fpu_struct *ctx, int has_fpu,
				    struct mips_fpu_struct *ctx, int has_fpu,
				    void *__user *fault_addr);
				    void __user **fault_addr);
void force_fcr31_sig(unsigned long fcr31, void __user *fault_addr,
void force_fcr31_sig(unsigned long fcr31, void __user *fault_addr,
		     struct task_struct *tsk);
		     struct task_struct *tsk);
int process_fpemu_return(int sig, void __user *fault_addr,
int process_fpemu_return(int sig, void __user *fault_addr,
+4 −4
Original line number Original line Diff line number Diff line
@@ -58,7 +58,7 @@ static int fpu_emu(struct pt_regs *, struct mips_fpu_struct *,
	mips_instruction);
	mips_instruction);


static int fpux_emu(struct pt_regs *,
static int fpux_emu(struct pt_regs *,
	struct mips_fpu_struct *, mips_instruction, void *__user *);
	struct mips_fpu_struct *, mips_instruction, void __user **);


/* Control registers */
/* Control registers */


@@ -973,7 +973,7 @@ static inline void cop1_ctc(struct pt_regs *xcp, struct mips_fpu_struct *ctx,
 */
 */


static int cop1Emulate(struct pt_regs *xcp, struct mips_fpu_struct *ctx,
static int cop1Emulate(struct pt_regs *xcp, struct mips_fpu_struct *ctx,
		struct mm_decoded_insn dec_insn, void *__user *fault_addr)
		struct mm_decoded_insn dec_insn, void __user **fault_addr)
{
{
	unsigned long contpc = xcp->cp0_epc + dec_insn.pc_inc;
	unsigned long contpc = xcp->cp0_epc + dec_insn.pc_inc;
	unsigned int cond, cbit, bit0;
	unsigned int cond, cbit, bit0;
@@ -1460,7 +1460,7 @@ DEF3OP(nmadd, dp, ieee754dp_mul, ieee754dp_add, ieee754dp_neg);
DEF3OP(nmsub, dp, ieee754dp_mul, ieee754dp_sub, ieee754dp_neg);
DEF3OP(nmsub, dp, ieee754dp_mul, ieee754dp_sub, ieee754dp_neg);


static int fpux_emu(struct pt_regs *xcp, struct mips_fpu_struct *ctx,
static int fpux_emu(struct pt_regs *xcp, struct mips_fpu_struct *ctx,
	mips_instruction ir, void *__user *fault_addr)
	mips_instruction ir, void __user **fault_addr)
{
{
	unsigned rcsr = 0;	/* resulting csr */
	unsigned rcsr = 0;	/* resulting csr */


@@ -2553,7 +2553,7 @@ static int fpu_emu(struct pt_regs *xcp, struct mips_fpu_struct *ctx,
 * For simplicity we always terminate upon an ISA mode switch.
 * For simplicity we always terminate upon an ISA mode switch.
 */
 */
int fpu_emulator_cop1Handler(struct pt_regs *xcp, struct mips_fpu_struct *ctx,
int fpu_emulator_cop1Handler(struct pt_regs *xcp, struct mips_fpu_struct *ctx,
	int has_fpu, void *__user *fault_addr)
	int has_fpu, void __user **fault_addr)
{
{
	unsigned long oldepc, prevepc;
	unsigned long oldepc, prevepc;
	struct mm_decoded_insn dec_insn;
	struct mm_decoded_insn dec_insn;