All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Russell King (Oracle)" <linux@armlinux.org.uk>
To: Chen Zhongjin <chenzhongjin@huawei.com>
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
Date: Thu, 31 Mar 2022 11:35:29 +0100	[thread overview]
Message-ID: <YkWD8bV8wSFUobrs@shell.armlinux.org.uk> (raw)
In-Reply-To: <c5a918fd-5700-267d-3159-6a034cce0a73@huawei.com>

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

WARNING: multiple messages have this Message-ID (diff)
From: "Russell King (Oracle)" <linux@armlinux.org.uk>
To: Chen Zhongjin <chenzhongjin@huawei.com>
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
Date: Thu, 31 Mar 2022 11:35:29 +0100	[thread overview]
Message-ID: <YkWD8bV8wSFUobrs@shell.armlinux.org.uk> (raw)
In-Reply-To: <c5a918fd-5700-267d-3159-6a034cce0a73@huawei.com>

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!

  reply	other threads:[~2022-03-31 10:36 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-03-25  1:12 [PATCH] ARM: module: Add all unwind tables when load module Chen Zhongjin
2022-03-25  1:12 ` Chen Zhongjin
2022-03-31  2:18 ` Chen Zhongjin
2022-03-31  2:18   ` Chen Zhongjin
2022-03-31  6:55 ` Russell King (Oracle)
2022-03-31  6:55   ` Russell King (Oracle)
2022-03-31 10:15   ` Chen Zhongjin
2022-03-31 10:15     ` Chen Zhongjin
2022-03-31 10:35     ` Russell King (Oracle) [this message]
2022-03-31 10:35       ` Russell King (Oracle)

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=YkWD8bV8wSFUobrs@shell.armlinux.org.uk \
    --to=linux@armlinux.org.uk \
    --cc=alexander.sverdlin@nokia.com \
    --cc=ardb@kernel.org \
    --cc=chenzhongjin@huawei.com \
    --cc=linus.walleij@linaro.org \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=nico@fluxnic.net \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.