From patchwork Tue May 29 15:00:42 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Eric W. Biederman" X-Patchwork-Id: 10435913 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id B763E60327 for ; Tue, 29 May 2018 15:02:56 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id A1BF1288A9 for ; Tue, 29 May 2018 15:02:56 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 9FA93286BA; Tue, 29 May 2018 15:02:56 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-7.9 required=2.0 tests=BAYES_00, MAILING_LIST_MULTI, RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id D3C1528968 for ; Tue, 29 May 2018 15:01:33 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S936416AbeE2PBF (ORCPT ); Tue, 29 May 2018 11:01:05 -0400 Received: from out01.mta.xmission.com ([166.70.13.231]:57534 "EHLO out01.mta.xmission.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S935244AbeE2PBA (ORCPT ); Tue, 29 May 2018 11:01:00 -0400 Received: from in01.mta.xmission.com ([166.70.13.51]) by out01.mta.xmission.com with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.87) (envelope-from ) id 1fNg7N-0004DH-O6; Tue, 29 May 2018 09:00:57 -0600 Received: from [97.119.174.25] (helo=x220.xmission.com) by in01.mta.xmission.com with esmtpsa (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.87) (envelope-from ) id 1fNg7M-0005BO-4e; Tue, 29 May 2018 09:00:57 -0600 From: ebiederm@xmission.com (Eric W. Biederman) To: Geert Uytterhoeven Cc: Rich Felker , Linux-Arch , Linux Kernel Mailing List , Yoshinori Sato , Linux-sh list References: <87604mhrnb.fsf@xmission.com> <20180420143811.9994-16-ebiederm@xmission.com> <20180420145514.GP3094@brightrain.aerifal.cx> Date: Tue, 29 May 2018 10:00:42 -0500 In-Reply-To: (Geert Uytterhoeven's message of "Mon, 28 May 2018 11:19:55 +0200") Message-ID: <87h8mqo6at.fsf_-_@xmission.com> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/25.1 (gnu/linux) MIME-Version: 1.0 X-XM-SPF: eid=1fNg7M-0005BO-4e; ; ; mid=<87h8mqo6at.fsf_-_@xmission.com>; ; ; hst=in01.mta.xmission.com; ; ; ip=97.119.174.25; ; ; frm=ebiederm@xmission.com; ; ; spf=neutral X-XM-AID: U2FsdGVkX1+IzCyZ7sfx9HjChTQEsrHLohqqvtTCE7s= X-SA-Exim-Connect-IP: 97.119.174.25 X-SA-Exim-Mail-From: ebiederm@xmission.com Subject: [PATCH] signal/sh: Stop gcc warning about an impossible case in do_divide_error X-SA-Exim-Version: 4.2.1 (built Thu, 05 May 2016 13:38:54 -0600) X-SA-Exim-Scanned: Yes (on in01.mta.xmission.com) Sender: linux-sh-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-sh@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP Geert Uytterhoeven 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 Fixes: c65626c0cd4d ("signal/sh: Use force_sig_fault where appropriate") Signed-off-by: "Eric W. Biederman" --- I am adding this fix to my tree to at least let the code build. arch/sh/kernel/traps_32.c | 3 +++ 1 file changed, 3 insertions(+) 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); }