mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH] objtool: Remove redundant section name comparison
@ 2020-04-12 14:44 Muchun Song
  2020-04-14 22:33 ` Josh Poimboeuf
  0 siblings, 1 reply; 2+ messages in thread
From: Muchun Song @ 2020-04-12 14:44 UTC (permalink / raw)
  To: jpoimboe, peterz, mingo, tglx; +Cc: linux-kernel, Muchun Song

If the prefix of section name is not '.rodata', the following
function call can never return 0.

    strcmp(sec->name, C_JUMP_TABLE_SECTION)

So the name comparison is pointless, just remove it.

Signed-off-by: Muchun Song <songmuchun@bytedance.com>
---
 tools/objtool/check.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/tools/objtool/check.c b/tools/objtool/check.c
index e637a4a38d2ad..401963179f1b9 100644
--- a/tools/objtool/check.c
+++ b/tools/objtool/check.c
@@ -1361,8 +1361,8 @@ static void mark_rodata(struct objtool_file *file)
 	 * .rodata.str1.* sections are ignored; they don't contain jump tables.
 	 */
 	for_each_sec(file, sec) {
-		if ((!strncmp(sec->name, ".rodata", 7) && !strstr(sec->name, ".str1.")) ||
-		    !strcmp(sec->name, C_JUMP_TABLE_SECTION)) {
+		if (!strncmp(sec->name, ".rodata", 7) &&
+		    !strstr(sec->name, ".str1.")) {
 			sec->rodata = true;
 			found = true;
 		}
-- 
2.11.0


^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: [PATCH] objtool: Remove redundant section name comparison
  2020-04-12 14:44 [PATCH] objtool: Remove redundant section name comparison Muchun Song
@ 2020-04-14 22:33 ` Josh Poimboeuf
  0 siblings, 0 replies; 2+ messages in thread
From: Josh Poimboeuf @ 2020-04-14 22:33 UTC (permalink / raw)
  To: Muchun Song; +Cc: peterz, mingo, tglx, linux-kernel

On Sun, Apr 12, 2020 at 10:44:05PM +0800, Muchun Song wrote:
> If the prefix of section name is not '.rodata', the following
> function call can never return 0.
> 
>     strcmp(sec->name, C_JUMP_TABLE_SECTION)
> 
> So the name comparison is pointless, just remove it.
> 
> Signed-off-by: Muchun Song <songmuchun@bytedance.com>

Thanks, added to the queue.

-- 
Josh


^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2020-04-14 22:34 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-04-12 14:44 [PATCH] objtool: Remove redundant section name comparison Muchun Song
2020-04-14 22:33 ` Josh Poimboeuf

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®