mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git
synced 2024-09-12 13:55:32 +00:00
powerpc/math: Fix missing __user qualifier for get_user() and other sparse warnings
Sparse reports the following problems: arch/powerpc/math-emu/math.c:228:21: warning: Using plain integer as NULL pointer arch/powerpc/math-emu/math.c:228:31: warning: Using plain integer as NULL pointer arch/powerpc/math-emu/math.c:228:41: warning: Using plain integer as NULL pointer arch/powerpc/math-emu/math.c:228:51: warning: Using plain integer as NULL pointer arch/powerpc/math-emu/math.c:237:13: warning: incorrect type in initializer (different address spaces) arch/powerpc/math-emu/math.c:237:13: expected unsigned int [noderef] __user *_gu_addr arch/powerpc/math-emu/math.c:237:13: got unsigned int [usertype] * arch/powerpc/math-emu/math.c:226:1: warning: symbol 'do_mathemu' was not declared. Should it be static? Add missing __user qualifier when casting pointer used in get_user() Use NULL instead of 0 to initialise opX local variables. Add a prototype for do_mathemu() (Added in processor.h like sparc) Reported-by: kernel test robot <lkp@intel.com> Signed-off-by: Christophe Leroy <christophe.leroy@csgroup.eu> Signed-off-by: Michael Ellerman <mpe@ellerman.id.au> Link: https://lore.kernel.org/r/e4d1aae7604d89c98a52dfd8ce8443462e595670.1615809591.git.christophe.leroy@csgroup.eu
This commit is contained in:
parent
7a7d744ffe
commit
e448e1e774
3 changed files with 4 additions and 3 deletions
|
@ -413,6 +413,8 @@ extern int fix_alignment(struct pt_regs *);
|
||||||
#define NET_IP_ALIGN 0
|
#define NET_IP_ALIGN 0
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
int do_mathemu(struct pt_regs *regs);
|
||||||
|
|
||||||
#endif /* __KERNEL__ */
|
#endif /* __KERNEL__ */
|
||||||
#endif /* __ASSEMBLY__ */
|
#endif /* __ASSEMBLY__ */
|
||||||
#endif /* _ASM_POWERPC_PROCESSOR_H */
|
#endif /* _ASM_POWERPC_PROCESSOR_H */
|
||||||
|
|
|
@ -1405,7 +1405,6 @@ int is_valid_bugaddr(unsigned long addr)
|
||||||
static int emulate_math(struct pt_regs *regs)
|
static int emulate_math(struct pt_regs *regs)
|
||||||
{
|
{
|
||||||
int ret;
|
int ret;
|
||||||
extern int do_mathemu(struct pt_regs *regs);
|
|
||||||
|
|
||||||
ret = do_mathemu(regs);
|
ret = do_mathemu(regs);
|
||||||
if (ret >= 0)
|
if (ret >= 0)
|
||||||
|
|
|
@ -225,7 +225,7 @@ record_exception(struct pt_regs *regs, int eflag)
|
||||||
int
|
int
|
||||||
do_mathemu(struct pt_regs *regs)
|
do_mathemu(struct pt_regs *regs)
|
||||||
{
|
{
|
||||||
void *op0 = 0, *op1 = 0, *op2 = 0, *op3 = 0;
|
void *op0 = NULL, *op1 = NULL, *op2 = NULL, *op3 = NULL;
|
||||||
unsigned long pc = regs->nip;
|
unsigned long pc = regs->nip;
|
||||||
signed short sdisp;
|
signed short sdisp;
|
||||||
u32 insn = 0;
|
u32 insn = 0;
|
||||||
|
@ -234,7 +234,7 @@ do_mathemu(struct pt_regs *regs)
|
||||||
int type = 0;
|
int type = 0;
|
||||||
int eflag, trap;
|
int eflag, trap;
|
||||||
|
|
||||||
if (get_user(insn, (u32 *)pc))
|
if (get_user(insn, (u32 __user *)pc))
|
||||||
return -EFAULT;
|
return -EFAULT;
|
||||||
|
|
||||||
switch (insn >> 26) {
|
switch (insn >> 26) {
|
||||||
|
|
Loading…
Reference in a new issue