Skip to contentSkip to conversation

bpf: btf: fix the brackets of BTF_INT_OFFSET()

PATCH Superseded Gary Lin 2 participants 3 messages May 13, 2019

Subsystems (2)

v1 of 2 Superseded Latest is v2 →

lore
Share & tools
lore

Gary Lin

author
#0 lore raw

PATCH 1/2 bpf: btf: fix the brackets of BTF_INT_OFFSET()

'VAL' should be protected by the brackets.

Fixes 69b693f0aefa ("bpf: btf: Introduce BPF Type Format (BTF)")
---
 include/uapi/linux/btf.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
include/uapi/linux/btf.h +1 -1
index 9310652ca4f9..63ae4a39e58b 100644
@@ -83,7 +83,7 @@ struct btf_type {
  * is the 32 bits arrangement:
  */
 #define BTF_INT_ENCODING(VAL)	(((VAL) & 0x0f000000) >> 24)
-#define BTF_INT_OFFSET(VAL)	(((VAL  & 0x00ff0000)) >> 16)
+#define BTF_INT_OFFSET(VAL)	(((VAL) & 0x00ff0000) >> 16)
 #define BTF_INT_BITS(VAL)	((VAL)  & 0x000000ff)
 
 /* Attributes stored in the BTF_INT_ENCODING */
Signature · 1 line
2.21.0
author
#1 lore raw

PATCH 2/2 docs/btf: update BTF_INT_OFFSET()

Fix BTF_INT_OFFSET() in the document

---
 Documentation/bpf/btf.rst | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
Documentation/bpf/btf.rst +1 -1
index 8820360d00da..35d83e24dbdb 100644
@@ -131,7 +131,7 @@ The following sections detail encoding of each kind.
 ``btf_type`` is followed by a ``u32`` with the following bits arrangement::
 
   #define BTF_INT_ENCODING(VAL)   (((VAL) & 0x0f000000) >> 24)
-  #define BTF_INT_OFFSET(VAL)     (((VAL  & 0x00ff0000)) >> 16)
+  #define BTF_INT_OFFSET(VAL)     (((VAL) & 0x00ff0000) >> 16)
   #define BTF_INT_BITS(VAL)       ((VAL)  & 0x000000ff)
 
 The ``BTF_INT_ENCODING`` has the following attributes::
Signature · 1 line
2.21.0
maintainer
#2 lore raw
In reply to Gary Lin
Quoted 14 lines · Gary Lin

'VAL' should be protected by the brackets.

Fixes 69b693f0aefa ("bpf: btf: Introduce BPF Type Format (BTF)")
---
 include/uapi/linux/btf.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
include/uapi/linux/btf.h +0 -0
index 9310652ca4f9..63ae4a39e58b 100644

include/uapi/linux/btf.h struct btf_type { · line 89

Quoted 8 lines
include/uapi/linux/btf.h +1 -1
@@ -83,7 +83,7 @@ struct btf_type {
  * is the 32 bits arrangement:
  */
 #define BTF_INT_ENCODING(VAL)	(((VAL) & 0x0f000000) >> 24)
-#define BTF_INT_OFFSET(VAL)	(((VAL  & 0x00ff0000)) >> 16)
+#define BTF_INT_OFFSET(VAL)	(((VAL) & 0x00ff0000) >> 16)
 #define BTF_INT_BITS(VAL)	((VAL)  & 0x000000ff)
 
 /* Attributes stored in the BTF_INT_ENCODING */

I'm okay with that fix, but could you please squash patch 1 and patch 2 into a single one? I don't think it's worth splitting them here.

Thanks,
Daniel