Message ID | 87h8mqo6at.fsf_-_@xmission.com (mailing list archive) |
---|---|
State | New, archived |
Headers | show |
Hello! On 5/29/2018 6:00 PM, Eric W. Biederman wrote: > 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. Lets. :-) > Reported-by: Geert Uytterhoeven <geert@linux-m68k.org> > Fixes: c65626c0cd4d ("signal/sh: Use force_sig_fault where appropriate") > Signed-off-by: "Eric W. Biederman" <ebiederm@xmission.com> [...] MBR, Sergei -- To unsubscribe from this list: send the line "unsubscribe linux-sh" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
diff --git a/arch/sh/kernel/traps_32.c b/arch/sh/kernel/traps_32.c index 660a4bc17698..60709ad17fc7 100644 --- a/arch/sh/kernel/traps_32.c +++ b/arch/sh/kernel/traps_32.c @@ -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); }