Skip to content

Commit 76d9c6c

Browse files
committed
Merge branch 'upstream' of git://git.linux-mips.org/pub/scm/ralf/upstream-linus
Pull MIPS fixes from Ralf Baechle: "Another round of fixes for 4.5: - Fix the use of an undocumented syntactial variant of the .type pseudo op which is not supported by the LLVM assembler. - Fix invalid initialization on S-cache-less systems. - Fix possible information leak from the kernel stack for SIGFPE. - Fix handling of copy_{from,to}_user() return value in KVM - Fix the last instance of irq_to_gpio() which now was causing build errors" * 'upstream' of git://git.linux-mips.org/pub/scm/ralf/upstream-linus: MIPS: traps: Fix SIGFPE information leak from `do_ov' and `do_trap_or_bp' MIPS: kvm: Fix ioctl error handling. MIPS: scache: Fix scache init with invalid line size. MIPS: Avoid variant of .type unsupported by LLVM Assembler MIPS: jz4740: Fix surviving instance of irq_to_gpio()
2 parents b8155fe + e723e3f commit 76d9c6c

File tree

5 files changed

+18
-14
lines changed

5 files changed

+18
-14
lines changed

arch/mips/jz4740/gpio.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -270,7 +270,7 @@ uint32_t jz_gpio_port_get_value(int port, uint32_t mask)
270270
}
271271
EXPORT_SYMBOL(jz_gpio_port_get_value);
272272

273-
#define IRQ_TO_BIT(irq) BIT(irq_to_gpio(irq) & 0x1f)
273+
#define IRQ_TO_BIT(irq) BIT((irq - JZ4740_IRQ_GPIO(0)) & 0x1f)
274274

275275
static void jz_gpio_check_trigger_both(struct jz_gpio_chip *chip, unsigned int irq)
276276
{

arch/mips/kernel/r2300_fpu.S

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -125,7 +125,7 @@ LEAF(_restore_fp_context)
125125
END(_restore_fp_context)
126126
.set reorder
127127

128-
.type fault@function
128+
.type fault, @function
129129
.ent fault
130130
fault: li v0, -EFAULT
131131
jr ra

arch/mips/kernel/r4k_fpu.S

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -358,7 +358,7 @@ LEAF(_restore_msa_all_upper)
358358

359359
.set reorder
360360

361-
.type fault@function
361+
.type fault, @function
362362
.ent fault
363363
fault: li v0, -EFAULT # failure
364364
jr ra

arch/mips/kernel/traps.c

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -690,15 +690,15 @@ static int simulate_sync(struct pt_regs *regs, unsigned int opcode)
690690
asmlinkage void do_ov(struct pt_regs *regs)
691691
{
692692
enum ctx_state prev_state;
693-
siginfo_t info;
693+
siginfo_t info = {
694+
.si_signo = SIGFPE,
695+
.si_code = FPE_INTOVF,
696+
.si_addr = (void __user *)regs->cp0_epc,
697+
};
694698

695699
prev_state = exception_enter();
696700
die_if_kernel("Integer overflow", regs);
697701

698-
info.si_code = FPE_INTOVF;
699-
info.si_signo = SIGFPE;
700-
info.si_errno = 0;
701-
info.si_addr = (void __user *) regs->cp0_epc;
702702
force_sig_info(SIGFPE, &info, current);
703703
exception_exit(prev_state);
704704
}
@@ -874,7 +874,7 @@ asmlinkage void do_fpe(struct pt_regs *regs, unsigned long fcr31)
874874
void do_trap_or_bp(struct pt_regs *regs, unsigned int code,
875875
const char *str)
876876
{
877-
siginfo_t info;
877+
siginfo_t info = { 0 };
878878
char b[40];
879879

880880
#ifdef CONFIG_KGDB_LOW_LEVEL_TRAP
@@ -903,7 +903,6 @@ void do_trap_or_bp(struct pt_regs *regs, unsigned int code,
903903
else
904904
info.si_code = FPE_INTOVF;
905905
info.si_signo = SIGFPE;
906-
info.si_errno = 0;
907906
info.si_addr = (void __user *) regs->cp0_epc;
908907
force_sig_info(SIGFPE, &info, current);
909908
break;

arch/mips/mm/sc-mips.c

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -164,21 +164,26 @@ static int __init mips_sc_probe_cm3(void)
164164

165165
sets = cfg & CM_GCR_L2_CONFIG_SET_SIZE_MSK;
166166
sets >>= CM_GCR_L2_CONFIG_SET_SIZE_SHF;
167-
c->scache.sets = 64 << sets;
167+
if (sets)
168+
c->scache.sets = 64 << sets;
168169

169170
line_sz = cfg & CM_GCR_L2_CONFIG_LINE_SIZE_MSK;
170171
line_sz >>= CM_GCR_L2_CONFIG_LINE_SIZE_SHF;
171-
c->scache.linesz = 2 << line_sz;
172+
if (line_sz)
173+
c->scache.linesz = 2 << line_sz;
172174

173175
assoc = cfg & CM_GCR_L2_CONFIG_ASSOC_MSK;
174176
assoc >>= CM_GCR_L2_CONFIG_ASSOC_SHF;
175177
c->scache.ways = assoc + 1;
176178
c->scache.waysize = c->scache.sets * c->scache.linesz;
177179
c->scache.waybit = __ffs(c->scache.waysize);
178180

179-
c->scache.flags &= ~MIPS_CACHE_NOT_PRESENT;
181+
if (c->scache.linesz) {
182+
c->scache.flags &= ~MIPS_CACHE_NOT_PRESENT;
183+
return 1;
184+
}
180185

181-
return 1;
186+
return 0;
182187
}
183188

184189
static inline int __init mips_sc_probe(void)

0 commit comments

Comments
 (0)