Skip to content

Commit

Permalink
signal/sh: Stop gcc warning about an impossible case in do_divide_error
Browse files Browse the repository at this point in the history
Geert Uytterhoeven <geert@linux-m68k.org> reported:
>   HOSTLD  scripts/mod/modpost
>   CC      arch/sh/kernel/traps_32.o
> arch/sh/kernel/traps_32.c: In function 'do_divide_error':
> arch/sh/kernel/traps_32.c:606:17: error: 'code' may be used uninitialized in this function [-Werror=uninitialized]
> cc1: all warnings being treated as errors

It is clear from inspection that do_divide_error is only called with
TRAP_DIVZERO_ERROR or TRAP_DIVOVF_ERROR, as that is the way
set_exception_table_vec is called.  So let gcc know the other cases
should not be considered by returning in all other cases.

This removes the warning and let's the code continue to build.

Reported-by: Geert Uytterhoeven <geert@linux-m68k.org>
Fixes: c65626c ("signal/sh: Use force_sig_fault where appropriate")
Signed-off-by: "Eric W. Biederman" <ebiederm@xmission.com>
  • Loading branch information
Eric W. Biederman committed May 29, 2018
1 parent 0bb0a11 commit 26da350
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions arch/sh/kernel/traps_32.c
Original file line number Diff line number Diff line change
Expand Up @@ -602,6 +602,9 @@ asmlinkage void do_divide_error(unsigned long r4)
case TRAP_DIVOVF_ERROR:
code = FPE_INTOVF;
break;
default:
/* Let gcc know unhandled cases don't make it past here */
return;
}
force_sig_fault(SIGFPE, code, NULL, current);
}
Expand Down

0 comments on commit 26da350

Please sign in to comment.