Received: by 2002:a05:7412:419a:b0:f3:1519:9f41 with SMTP id i26csp4962358rdh; Wed, 29 Nov 2023 16:32:27 -0800 (PST) X-Google-Smtp-Source: AGHT+IFv2c9qNx0b8pDQg/0jccefpQJ8hldO52QrwUwW+wfD0oWkHPcEvhMj1DdYFv/KfIzPK2hV X-Received: by 2002:a05:6358:524d:b0:16c:70c:7f63 with SMTP id c13-20020a056358524d00b0016c070c7f63mr23876126rwa.27.1701304347628; Wed, 29 Nov 2023 16:32:27 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1701304347; cv=none; d=google.com; s=arc-20160816; b=IlbTOeP2T57oIvf5ya07ohZ1seQjJx7XMUUZ10L+zuVjNbSf/VIJp68m24cL+DX5YV /cFPT1BUIweWPcj/5NTCOUFed13eBe2kdq8oInibfISVEM7hHrlvtyGDCAzMyLTdKt5/ S6aiuI7SJWN0BIIZJPvc3nZFfPGxWq/Np9ENszLXTIxgZfJ3vBN2WE6uLX9apip1onmf eTfCjYMqbfyaA3XTaLNLt6ztAgKy8PrxjEJMZDdQqzhflvIB9uTXTnE7jwvp8/B+qLcJ y3dMzGPEN/JCATcV0DaUYpzhW2HykFl3VgVeXU02IErj62j7jSe368Z0+ZNFXZfg6c4i n3hQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date:dkim-signature; bh=MFRGtrFn9bib7dFhvN8toLeS/Tz1Oc5ZvNTke28jew8=; fh=kzQbY2VWCNYHOBrv8n3HKFBQNH7Ctw9D+bVaT5LgeBo=; b=lShi6OEnQiswS0PG8XJqrAc9HIfk27WwCWGTAlGxRXQIROM3oEA7ps6kpW5g9mmjqo Ke+KddDuN5X70rdHtU7yYANn6vRetKRlxEVt9G3gZcLxGYKQNA6dcDTBeeLWvn+hm0sp VKZmOmZ0XiBN2QHiq/TZFJR5sDAgp8EvTEn9aJMFRIRtwiZX2gHgU/tHfvMFTBodmn6V 0Ph5SI3JmiALt+O7YSFKxLnkvdJSErZfA2fpFrUv3aRJttp8Q4e+O0UfaYta8ywCbSJ3 fDybK2MaXIKZx99LCCx+oG96wO7KOEb7kE0fQ6jlwrQCx6qMSqvX+GHvaXH0xVJStnfZ UB+Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=f3FK9HcP; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:6 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from pete.vger.email (pete.vger.email. [2620:137:e000::3:6]) by mx.google.com with ESMTPS id z15-20020a63e54f000000b005c221909d4asi28462pgj.830.2023.11.29.16.32.24 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 29 Nov 2023 16:32:27 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:6 as permitted sender) client-ip=2620:137:e000::3:6; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=f3FK9HcP; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:6 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by pete.vger.email (Postfix) with ESMTP id 28CAF81F37B6; Wed, 29 Nov 2023 16:32:22 -0800 (PST) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.11 at pete.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232995AbjK3AcF (ORCPT + 99 others); Wed, 29 Nov 2023 19:32:05 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:54532 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229677AbjK3AcD (ORCPT ); Wed, 29 Nov 2023 19:32:03 -0500 Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 200971A6 for ; Wed, 29 Nov 2023 16:32:10 -0800 (PST) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 7C58FC433C7; Thu, 30 Nov 2023 00:32:09 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1701304329; bh=sWTZRFs3LpzmxPcfO3M2aIt9v0k5GfKcQDamobqt17I=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=f3FK9HcPl3lhLpfF6lkcbEeA2aI0sYUCtwwghlEFKnuLYH6krMrGR81GpJY3MmJbT 80nRU8sIxCxJ9H5HfLmLQYqg0Zo56C8IxbToyb5Z4W7dO2ayMmXduy2zq7/LS4oGUe Cpkq5Tkd3qhwKt8O6W6WND6FWlpBPgPme9TePxSkCwxA/UDNDFysFcjrsC9BrehP7f IQM93kmasmjIu36h2mNO/7mbqm3u+ORiwCEONIh9nPKzwL9Cmv8amSnGHFx6lSyWBL b9R589WnaarzVSV548Q91I5rgRxVYBwarANnrPu770SVphzPxnntt6A7gmiTHT5Hw5 JOJA7mgCVp3LQ== Date: Wed, 29 Nov 2023 17:32:07 -0700 From: Nathan Chancellor To: Masahiro Yamada Cc: linux-kbuild@vger.kernel.org, linux-kernel@vger.kernel.org, Nicolas Schier Subject: Re: [PATCH 3/3] modpost: move exit(1) for fatal() to modpost.h Message-ID: <20231130003207.GD2513828@dev-arch.thelio-3990X> References: <20231125103116.797608-1-masahiroy@kernel.org> <20231125103116.797608-3-masahiroy@kernel.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20231125103116.797608-3-masahiroy@kernel.org> X-Spam-Status: No, score=-1.2 required=5.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,MAILING_LIST_MULTI, SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on pete.vger.email Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (pete.vger.email [0.0.0.0]); Wed, 29 Nov 2023 16:32:22 -0800 (PST) On Sat, Nov 25, 2023 at 07:31:16PM +0900, Masahiro Yamada wrote: > fatal() never returns, but compilers are not aware of this fact because > exit(1) is called within the modpost_log() definition. > > Move exit(1) to the fatal() macro so that compilers can identify > unreachable code flows. > > Remove the initializer for 'taddr' in section_rel(), as compilers now > recognize this is not an uninitialized bug. > > Signed-off-by: Masahiro Yamada While I did not see any warnings when testing, it seems like this patch should come before patch 2 to avoid any potential problems from dropping the unreachable code (since the compiler won't be able to infer that fatal() is __noreturn without this change); doesn't really matter though so: Reviewed-by: Nathan Chancellor > --- > > scripts/mod/modpost.c | 4 +--- > scripts/mod/modpost.h | 2 +- > 2 files changed, 2 insertions(+), 4 deletions(-) > > diff --git a/scripts/mod/modpost.c b/scripts/mod/modpost.c > index 013fc5031bc7..696c583a14ec 100644 > --- a/scripts/mod/modpost.c > +++ b/scripts/mod/modpost.c > @@ -84,8 +84,6 @@ void modpost_log(enum loglevel loglevel, const char *fmt, ...) > vfprintf(stderr, fmt, arglist); > va_end(arglist); > > - if (loglevel == LOG_FATAL) > - exit(1); > if (loglevel == LOG_ERROR) > error_occurred = true; > } > @@ -1415,7 +1413,7 @@ static void section_rel(struct module *mod, struct elf_info *elf, > > for (rel = start; rel < stop; rel++) { > Elf_Sym *tsym; > - Elf_Addr taddr = 0, r_offset; > + Elf_Addr taddr, r_offset; > unsigned int r_type, r_sym; > void *loc; > > diff --git a/scripts/mod/modpost.h b/scripts/mod/modpost.h > index 9fe974dc1a52..aaa67b24775e 100644 > --- a/scripts/mod/modpost.h > +++ b/scripts/mod/modpost.h > @@ -215,4 +215,4 @@ modpost_log(enum loglevel loglevel, const char *fmt, ...); > */ > #define warn(fmt, args...) modpost_log(LOG_WARN, fmt, ##args) > #define error(fmt, args...) modpost_log(LOG_ERROR, fmt, ##args) > -#define fatal(fmt, args...) modpost_log(LOG_FATAL, fmt, ##args) > +#define fatal(fmt, args...) do { modpost_log(LOG_FATAL, fmt, ##args); exit(1); } while (1) > -- > 2.40.1 >