* [PATCH] bpf, x32: remove unneeded conversion to bool
@ 2020-04-20 12:37 Jason Yan
2020-04-22 18:43 ` H. Peter Anvin
0 siblings, 1 reply; 4+ messages in thread
From: Jason Yan @ 2020-04-20 12:37 UTC (permalink / raw)
To: udknight, davem, kuznet, yoshfuji, tglx, mingo, bp, x86, hpa,
ast, daniel, kafai, songliubraving, yhs, andriin, john.fastabend,
kpsingh, lukenels, netdev, bpf, linux-kernel
Cc: Jason Yan
The '==' expression itself is bool, no need to convert it to bool again.
This fixes the following coccicheck warning:
arch/x86/net/bpf_jit_comp32.c:1478:50-55: WARNING: conversion to bool
not needed here
arch/x86/net/bpf_jit_comp32.c:1479:50-55: WARNING: conversion to bool
not needed here
Signed-off-by: Jason Yan <yanaijie@huawei.com>
---
arch/x86/net/bpf_jit_comp32.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/arch/x86/net/bpf_jit_comp32.c b/arch/x86/net/bpf_jit_comp32.c
index 4d2a7a764602..b41ba3517819 100644
--- a/arch/x86/net/bpf_jit_comp32.c
+++ b/arch/x86/net/bpf_jit_comp32.c
@@ -1475,8 +1475,8 @@ static int do_jit(struct bpf_prog *bpf_prog, int *addrs, u8 *image,
for (i = 0; i < insn_cnt; i++, insn++) {
const s32 imm32 = insn->imm;
const bool is64 = BPF_CLASS(insn->code) == BPF_ALU64;
- const bool dstk = insn->dst_reg == BPF_REG_AX ? false : true;
- const bool sstk = insn->src_reg == BPF_REG_AX ? false : true;
+ const bool dstk = insn->dst_reg != BPF_REG_AX;
+ const bool sstk = insn->src_reg != BPF_REG_AX;
const u8 code = insn->code;
const u8 *dst = bpf2ia32[insn->dst_reg];
const u8 *src = bpf2ia32[insn->src_reg];
--
2.21.1
^ permalink raw reply related [flat|nested] 4+ messages in thread
* Re: [PATCH] bpf, x32: remove unneeded conversion to bool
2020-04-20 12:37 [PATCH] bpf, x32: remove unneeded conversion to bool Jason Yan
@ 2020-04-22 18:43 ` H. Peter Anvin
2020-04-23 2:10 ` Wang YanQing
0 siblings, 1 reply; 4+ messages in thread
From: H. Peter Anvin @ 2020-04-22 18:43 UTC (permalink / raw)
To: Jason Yan, udknight, davem, kuznet, yoshfuji, tglx, mingo, bp,
x86, ast, daniel, kafai, songliubraving, yhs, andriin,
john.fastabend, kpsingh, lukenels, netdev, bpf, linux-kernel
On 2020-04-20 05:37, Jason Yan wrote:
> The '==' expression itself is bool, no need to convert it to bool again.
> This fixes the following coccicheck warning:
>
> arch/x86/net/bpf_jit_comp32.c:1478:50-55: WARNING: conversion to bool
> not needed here
> arch/x86/net/bpf_jit_comp32.c:1479:50-55: WARNING: conversion to bool
> not needed here
>
> Signed-off-by: Jason Yan <yanaijie@huawei.com>
> ---
> arch/x86/net/bpf_jit_comp32.c | 4 ++--
> 1 file changed, 2 insertions(+), 2 deletions(-)
>
x32 is not i386.
-hpa
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH] bpf, x32: remove unneeded conversion to bool
2020-04-22 18:43 ` H. Peter Anvin
@ 2020-04-23 2:10 ` Wang YanQing
2020-04-23 9:40 ` H. Peter Anvin
0 siblings, 1 reply; 4+ messages in thread
From: Wang YanQing @ 2020-04-23 2:10 UTC (permalink / raw)
To: H. Peter Anvin
Cc: Jason Yan, davem, kuznet, yoshfuji, tglx, mingo, bp, x86, ast,
daniel, kafai, songliubraving, yhs, andriin, john.fastabend,
kpsingh, lukenels, netdev, bpf, linux-kernel
On Wed, Apr 22, 2020 at 11:43:58AM -0700, H. Peter Anvin wrote:
> On 2020-04-20 05:37, Jason Yan wrote:
> > The '==' expression itself is bool, no need to convert it to bool again.
> > This fixes the following coccicheck warning:
> >
> > arch/x86/net/bpf_jit_comp32.c:1478:50-55: WARNING: conversion to bool
> > not needed here
> > arch/x86/net/bpf_jit_comp32.c:1479:50-55: WARNING: conversion to bool
> > not needed here
> >
> > Signed-off-by: Jason Yan <yanaijie@huawei.com>
> > ---
> > arch/x86/net/bpf_jit_comp32.c | 4 ++--
> > 1 file changed, 2 insertions(+), 2 deletions(-)
> >
>
> x32 is not i386.
>
> -hpa
Hi! H. Peter Anvin and all
I use the name "x86_32" to describe it in original commit 03f5781be2c7
("bpf, x86_32: add eBPF JIT compiler for ia32"), but almost all following
committers and contributors use the world "x32", I think it is short format
for x{86_}32.
Yes, I agree, "x32" isn't the right name here, I think "x32" is well known
as a ABI, so maybe we should use "x86_32" or ia32 in future communication.
Which one is the best name here? x86_32 or ia32 or anything other?
Thanks!
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH] bpf, x32: remove unneeded conversion to bool
2020-04-23 2:10 ` Wang YanQing
@ 2020-04-23 9:40 ` H. Peter Anvin
0 siblings, 0 replies; 4+ messages in thread
From: H. Peter Anvin @ 2020-04-23 9:40 UTC (permalink / raw)
To: Wang YanQing, Jason Yan, davem, kuznet, yoshfuji, tglx, mingo,
bp, x86, ast, daniel, kafai, songliubraving, yhs, andriin,
john.fastabend, kpsingh, lukenels, netdev, bpf, linux-kernel
On 2020-04-22 19:10, Wang YanQing wrote:
> On Wed, Apr 22, 2020 at 11:43:58AM -0700, H. Peter Anvin wrote:
>> On 2020-04-20 05:37, Jason Yan wrote:
>>> The '==' expression itself is bool, no need to convert it to bool again.
>>> This fixes the following coccicheck warning:
>>>
>>> arch/x86/net/bpf_jit_comp32.c:1478:50-55: WARNING: conversion to bool
>>> not needed here
>>> arch/x86/net/bpf_jit_comp32.c:1479:50-55: WARNING: conversion to bool
>>> not needed here
>>>
>>> Signed-off-by: Jason Yan <yanaijie@huawei.com>
>>> ---
>>> arch/x86/net/bpf_jit_comp32.c | 4 ++--
>>> 1 file changed, 2 insertions(+), 2 deletions(-)
>>>
>>
>> x32 is not i386.
>>
>> -hpa
> Hi! H. Peter Anvin and all
>
> I use the name "x86_32" to describe it in original commit 03f5781be2c7
> ("bpf, x86_32: add eBPF JIT compiler for ia32"), but almost all following
> committers and contributors use the world "x32", I think it is short format
> for x{86_}32.
>
> Yes, I agree, "x32" isn't the right name here, I think "x32" is well known
> as a ABI, so maybe we should use "x86_32" or ia32 in future communication.
>
> Which one is the best name here? x86_32 or ia32 or anything other?
>
x86-32 or i386.
-hpa
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2020-04-23 9:41 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-04-20 12:37 [PATCH] bpf, x32: remove unneeded conversion to bool Jason Yan
2020-04-22 18:43 ` H. Peter Anvin
2020-04-23 2:10 ` Wang YanQing
2020-04-23 9:40 ` H. Peter Anvin
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).