Skip to contentSkip to conversation

Fix definition of BPF_NEG operation

PATCH Applied Dave Thaler 3 participants 3 messages Jun 27, 2023 – Jun 29, 2023

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 Fix definition of BPF_NEG operation

From: Dave Thaler <[email protected]>

Instruction is an arithmetic negative, not a bitwise inverse.

---
 Documentation/bpf/instruction-set.rst | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
Documentation/bpf/instruction-set.rst +1 -1
index 6644842cd3e..751e657973f 100644
@@ -165,7 +165,7 @@ BPF_OR    0x40   dst \|= src
 BPF_AND   0x50   dst &= src
 BPF_LSH   0x60   dst <<= (src & mask)
 BPF_RSH   0x70   dst >>= (src & mask)
-BPF_NEG   0x80   dst = ~src
+BPF_NEG   0x80   dst = -src
 BPF_MOD   0x90   dst = (src != 0) ? (dst % src) : dst
 BPF_XOR   0xa0   dst ^= src
 BPF_MOV   0xb0   dst = src
Signature · 1 line
2.33.4
Acked-by on v1 1/1
#1 lore raw
Quoted 5 lines · Dave Thaler

From: Dave Thaler <[email protected]>

Instruction is an arithmetic negative, not a bitwise inverse.

Quoted 24 lines
---
 Documentation/bpf/instruction-set.rst | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
Documentation/bpf/instruction-set.rst +1 -1
index 6644842cd3e..751e657973f 100644
@@ -165,7 +165,7 @@ BPF_OR    0x40   dst \|= src
 BPF_AND   0x50   dst &= src
 BPF_LSH   0x60   dst <<= (src & mask)
 BPF_RSH   0x70   dst >>= (src & mask)
-BPF_NEG   0x80   dst = ~src
+BPF_NEG   0x80   dst = -src
 BPF_MOD   0x90   dst = (src != 0) ? (dst % src) : dst
 BPF_XOR   0xa0   dst ^= src
 BPF_MOV   0xb0   dst = src
Signature · 6 lines
2.33.4

-- 
Bpf mailing list
[email protected]
https://www.ietf.org/mailman/listinfo/bpf
#2 lore raw
In reply to Dave Thaler
This patch was applied to bpf/bpf-next.git (master) by Daniel Borkmann <[email protected]>:

Hello:

This patch was applied to bpf/bpf-next.git (master) by Daniel Borkmann <[email protected]>:

Quoted 8 lines · On Tue, 27 Jun 2023 21:39:12 +0000 you wrote:

From: Dave Thaler <[email protected]>

Instruction is an arithmetic negative, not a bitwise inverse.

---
 Documentation/bpf/instruction-set.rst | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Here is the summary with links:
- [bpf-next] Fix definition of BPF_NEG operation

    https://git.kernel.org/bpf/bpf-next/c/85b0c6d4905e

You are awesome, thank you!

Signature · 2 lines
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html