From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 0D4B6C433EF for ; Thu, 31 Mar 2022 10:36:58 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:In-Reply-To:MIME-Version:References: Message-ID:Subject:Cc:To:From:Date:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=DycDORoOAGDe+EaHdP+EkgKjYVmLsoI+kIaobrn8s8k=; b=GC7ta0Ms24eJal nqvy3H/l11cW56x/kELwxVchM/SXT3yHYUhSJ/kq26kVEHchghAuBYPEpotGRG+Pm3JELDd9c7sfv NrXoBJv86XyIUEwdl8t/5wMDAuCMQ+XOSQBzf3v6oUK8ANPpU7Kw9F+2cmXUeXGV0SLz9fHav14dC p0ENSR95wNP1sjtfTmlpucUGbz6XkUYR58VyJcbtDlvCTCcEyu4/cC+AU/Q/zO62xiPEnGFEaKXf4 dB/7464C3WM0Su4MgEGbxqVV+mLgyovCNbWcMbxJMQ1EkRgcpr3ZQ2ubnLnWHFggQVoICIdVApx28 R7ty3+frdLCllTY87cUA==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1nZs9a-001s9h-4E; Thu, 31 Mar 2022 10:35:46 +0000 Received: from pandora.armlinux.org.uk ([2001:4d48:ad52:32c8:5054:ff:fe00:142]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1nZs9W-001s8h-Ma for linux-arm-kernel@lists.infradead.org; Thu, 31 Mar 2022 10:35:44 +0000 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=armlinux.org.uk; s=pandora-2019; h=Sender:In-Reply-To:Content-Type: MIME-Version:References:Message-ID:Subject:Cc:To:From:Date:Reply-To: Content-Transfer-Encoding:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Id: List-Help:List-Unsubscribe:List-Subscribe:List-Post:List-Owner:List-Archive; bh=jLzRFqL/t5POvysK4DG5ydOswhwMgCsJK5hg+X7TMEQ=; b=XlOPqhxhWlwBvktNnKEKYKRJtm jszIY35PqTZzLqy2qlCbxB7dkFZ2RiJbVjRWH3+m+StkjM0uDs39KjPFnBquIgIuNhbKRs7mVasVt Pqh962VKR0ffi3kmVuFD66q0oO6pMoOgKml0IGqfQ4LuNyrxBqX0bvvMhByUVZkyBNmTli/cZ/NJC QEOQU0wPmrqscDJJyFFCQphRcQZ+Hm6S8UJ/LVDN5UnAgaboiFWFhoGPn9fTpN8YkYPo9GVCuQgQu iJWdTiFj4eKQ8twXtin1V5oN04UGURQtks/Ev5L3uzS5ikvsbSVlRv1Fwe/CW+Z9LsKBpLBSRIGWQ yhZ1+5qQ==; Received: from shell.armlinux.org.uk ([fd8f:7570:feb6:1:5054:ff:fe00:4ec]:58044) by pandora.armlinux.org.uk with esmtpsa (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1nZs9N-0004dn-1Q; Thu, 31 Mar 2022 11:35:32 +0100 Received: from linux by shell.armlinux.org.uk with local (Exim 4.94.2) (envelope-from ) id 1nZs9J-0007XH-1g; Thu, 31 Mar 2022 11:35:29 +0100 Date: Thu, 31 Mar 2022 11:35:29 +0100 From: "Russell King (Oracle)" To: Chen Zhongjin Cc: alexander.sverdlin@nokia.com, ardb@kernel.org, linus.walleij@linaro.org, nico@fluxnic.net, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH] ARM: module: Add all unwind tables when load module Message-ID: References: <20220325011252.55844-1-chenzhongjin@huawei.com> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20220331_033543_048514_CA2D158B X-CRM114-Status: GOOD ( 12.38 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org On Thu, Mar 31, 2022 at 06:15:09PM +0800, Chen Zhongjin wrote: > Hi Russell, > > Thanks for comment! I've pushed v2 patch with your advises. > > > > - memset(maps, 0, sizeof(maps)); > > > + INIT_LIST_HEAD(&table_list->mod_list); > > > + mod->arch.init_table = NULL; > > > for (s = sechdrs; s < sechdrs_end; s++) { > > > - const char *secname = secstrs + s->sh_name; > > > + const unsigned int sectype = s->sh_type; > > Please loose this local variable. > > Also I moved "txtname" inside func params. > > + const char *txtname = strcmp(".ARM.exidx", secname) == 0 ? > + ".text" : secname + strlen(".ARM.exidx"); > + const Elf_Shdr *txt_sec = find_mod_section(hdr, sechdrs, txtname); > > >>> > > + const Elf_Shdr *txt_sec = find_mod_section(hdr, sechdrs, > + strcmp(".ARM.exidx", secname) ? > + secname + strlen(".ARM.exidx") : ".text"); > Hmm. I wonder whether it should be: const Elf_Shdr *txt_sec; const char *txtname; if (!strcmp(".ARM.exidx", secname)) txtname = ".text"; else txtname = secname + strlen(".ARM.exidx"); txt_sec = find_mod_section(hdr, sechdrs, txtname); which looks cleaner to me. -- RMK's Patch system: https://www.armlinux.org.uk/developer/patches/ FTTP is here! 40Mbps down 10Mbps up. Decent connectivity at last! _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel