All of lore.kernel.org
 help / color / mirror / Atom feed
From: cgel.zte@gmail.com
To: peterz@infradead.org
Cc: jpoimboe@redhat.com, jbaron@akamai.com, rostedt@goodmis.org,
	ardb@kernel.org, tglx@linutronix.de, mingo@redhat.com,
	bp@alien8.de, x86@kernel.org, hpa@zytor.com,
	linux-kernel@vger.kernel.org, Yang Guang <yang.guang5@zte.com.cn>
Subject: [PATCH] Fix the bool convert to int issue
Date: Sat, 18 Sep 2021 07:30:37 +0000	[thread overview]
Message-ID: <20210918073037.239634-1-yang.guang5@zte.com.cn> (raw)

From: Yang Guang <yang.guang5@zte.com.cn>

The int value which convert from bool true is 0xFFFFFFFF. Causing the
__sc_insn return wrong type.

Signed-off-by: Yang Guang <yang.guang5@zte.com.cn>
---
 arch/x86/kernel/static_call.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/arch/x86/kernel/static_call.c b/arch/x86/kernel/static_call.c
index ea028e736831..f608e6710300 100644
--- a/arch/x86/kernel/static_call.c
+++ b/arch/x86/kernel/static_call.c
@@ -89,7 +89,7 @@ static inline enum insn_type __sc_insn(bool null, bool tail)
 	 *	  1  |   0   |  JMP
 	 *	  1  |   1   |  RET
 	 */
-	return 2*tail + null;
+	return ((tail)?2:0) + ((null)?1:0);
 }
 
 void arch_static_call_transform(void *site, void *tramp, void *func, bool tail)
-- 
2.25.1


             reply	other threads:[~2021-09-18  7:30 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-09-18  7:30 cgel.zte [this message]
2021-09-18  8:20 ` [PATCH] Fix the bool convert to int issue Peter Zijlstra

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=20210918073037.239634-1-yang.guang5@zte.com.cn \
    --to=cgel.zte@gmail.com \
    --cc=ardb@kernel.org \
    --cc=bp@alien8.de \
    --cc=hpa@zytor.com \
    --cc=jbaron@akamai.com \
    --cc=jpoimboe@redhat.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mingo@redhat.com \
    --cc=peterz@infradead.org \
    --cc=rostedt@goodmis.org \
    --cc=tglx@linutronix.de \
    --cc=x86@kernel.org \
    --cc=yang.guang5@zte.com.cn \
    /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.