Commit 9ec9b5ac239ebfff333c25c4a7d34649cb29e4e4
1 parent
90c9e79f5d
Exists in
master
and in
20 other branches
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>
Showing 1 changed file with 8 additions and 5 deletions Side-by-side Diff
arch/mips/kernel/signal.c
... | ... | @@ -568,17 +568,20 @@ |
568 | 568 | } |
569 | 569 | |
570 | 570 | if (regs->regs[0]) { |
571 | - if (regs->regs[2] == ERESTARTNOHAND || | |
572 | - regs->regs[2] == ERESTARTSYS || | |
573 | - regs->regs[2] == ERESTARTNOINTR) { | |
571 | + switch (regs->regs[2]) { | |
572 | + case ERESTARTNOHAND: | |
573 | + case ERESTARTSYS: | |
574 | + case ERESTARTNOINTR: | |
574 | 575 | regs->regs[2] = regs->regs[0]; |
575 | 576 | regs->regs[7] = regs->regs[26]; |
576 | 577 | regs->cp0_epc -= 4; |
577 | - } | |
578 | - if (regs->regs[2] == ERESTART_RESTARTBLOCK) { | |
578 | + break; | |
579 | + | |
580 | + case ERESTART_RESTARTBLOCK: | |
579 | 581 | regs->regs[2] = current->thread.abi->restart; |
580 | 582 | regs->regs[7] = regs->regs[26]; |
581 | 583 | regs->cp0_epc -= 4; |
584 | + break; | |
582 | 585 | } |
583 | 586 | regs->regs[0] = 0; /* Don't deal with this again. */ |
584 | 587 | } |