summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRalf Baechle <ralf@linux-mips.org>2012-11-06 14:27:19 +0100
committerRalf Baechle <ralf@linux-mips.org>2012-12-12 16:52:07 +0100
commit9ec9b5ac239ebfff333c25c4a7d34649cb29e4e4 (patch)
treeadd188e2bf10446cc998cdc7b768c3aa7945ff95
parent90c9e79f5dc5af4ea16ad56dda8b648d21037486 (diff)
MIPS: Fix harmlessly missing else statement.
The actual bug is a missing else statement - but really this should be expressed using a switch() statement. Found by Al Viro who writes "the funny thing is, it *does* work only because r2 is syscall number and syscall number around 512 => return value being ENOSYS and not one of ERESTART... so we really can't hit the first if and emerge from it with ERESTART_RESTARTBLOCK. still wrong to write it that way..." Signed-off-by: Ralf Baechle <ralf@linux-mips.org>
-rw-r--r--arch/mips/kernel/signal.c13
1 files changed, 8 insertions, 5 deletions
diff --git a/arch/mips/kernel/signal.c b/arch/mips/kernel/signal.c
index 0e1a5b8ae817..b6aa77035019 100644
--- a/arch/mips/kernel/signal.c
+++ b/arch/mips/kernel/signal.c
@@ -568,17 +568,20 @@ static void do_signal(struct pt_regs *regs)
}
if (regs->regs[0]) {
- if (regs->regs[2] == ERESTARTNOHAND ||
- regs->regs[2] == ERESTARTSYS ||
- regs->regs[2] == ERESTARTNOINTR) {
+ switch (regs->regs[2]) {
+ case ERESTARTNOHAND:
+ case ERESTARTSYS:
+ case ERESTARTNOINTR:
regs->regs[2] = regs->regs[0];
regs->regs[7] = regs->regs[26];
regs->cp0_epc -= 4;
- }
- if (regs->regs[2] == ERESTART_RESTARTBLOCK) {
+ break;
+
+ case ERESTART_RESTARTBLOCK:
regs->regs[2] = current->thread.abi->restart;
regs->regs[7] = regs->regs[26];
regs->cp0_epc -= 4;
+ break;
}
regs->regs[0] = 0; /* Don't deal with this again. */
}