Skip to contentSkip to conversation

bpf: fix inconsistent return types of bpf_xdp_copy_buf().

PATCH Applied [email protected] 4 participants 4 messages Aug 4, 2023

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

PATCH 1/1 bpf: fix inconsistent return types of bpf_xdp_copy_buf().

From: Kui-Feng Lee <[email protected]>

Fix inconsistent return types in two implementations of bpf_xdp_copy_buf().

There are two implementations: one is an empty implementation whose return type does not match the actual implementation.

---
 include/linux/filter.h | 5 ++---
 1 file changed, 2 insertions(+), 3 deletions(-)
include/linux/filter.h +2 -3
index 2d6fe30bad5f..761af6b3cf2b 100644
@@ -1572,10 +1572,9 @@ static inline void *bpf_xdp_pointer(struct xdp_buff *xdp, u32 offset, u32 len)
 	return NULL;
 }
 
-static inline void *bpf_xdp_copy_buf(struct xdp_buff *xdp, unsigned long off, void *buf,
-				     unsigned long len, bool flush)
+static inline void bpf_xdp_copy_buf(struct xdp_buff *xdp, unsigned long off, void *buf,
+				    unsigned long len, bool flush)
 {
-	return NULL;
 }
 #endif /* CONFIG_NET */
 
Signature · 1 line
2.34.1
reviewer Acked-by on v1 1/1
#1 lore raw
Quoted 9 lines · On 8/3/23 5:51 PM, [email protected] wrote:

From: Kui-Feng Lee <[email protected]>

Fix inconsistent return types in two implementations of bpf_xdp_copy_buf().

There are two implementations: one is an empty implementation whose return type does not match the actual implementation.

Looks like a fix tag is not needed as the old code won't cause compilation warnings or runtime errors despite the signature mismatch.

Quoted 21 lines
---
  include/linux/filter.h | 5 ++---
  1 file changed, 2 insertions(+), 3 deletions(-)
include/linux/filter.h +2 -3
index 2d6fe30bad5f..761af6b3cf2b 100644
@@ -1572,10 +1572,9 @@ static inline void *bpf_xdp_pointer(struct xdp_buff *xdp, u32 offset, u32 len)
  	return NULL;
  }
 
-static inline void *bpf_xdp_copy_buf(struct xdp_buff *xdp, unsigned long off, void *buf,
-				     unsigned long len, bool flush)
+static inline void bpf_xdp_copy_buf(struct xdp_buff *xdp, unsigned long off, void *buf,
+				    unsigned long len, bool flush)
  {
-	return NULL;
  }
  #endif /* CONFIG_NET */
 
#2 lore raw
Quoted 10 lines · Yonghong Song
Quoted 7 lines · On 8/3/23 5:51 PM, [email protected] wrote:

From: Kui-Feng Lee <[email protected]>

Fix inconsistent return types in two implementations of bpf_xdp_copy_buf().

There are two implementations: one is an empty implementation whose return type does not match the actual implementation.

Quoted 7 lines
Quoted 2 lines

Looks like a fix tag is not needed as the old code won't cause compilation warnings or runtime errors despite the signature mismatch.

Thank you for the review!

Quoted 23 lines
Quoted 23 lines

---
  include/linux/filter.h | 5 ++---

  1 file changed, 2 insertions(+), 3 deletions(-)
include/linux/filter.h +2 -3
index 2d6fe30bad5f..761af6b3cf2b 100644
@@ -1572,10 +1572,9 @@ static inline void *bpf_xdp_pointer(struct 
 xdp_buff *xdp, u32 offset, u32 len)
       return NULL;
   }
-static inline void *bpf_xdp_copy_buf(struct xdp_buff *xdp, unsigned 
 long off, void *buf,
-                     unsigned long len, bool flush)
+static inline void bpf_xdp_copy_buf(struct xdp_buff *xdp, unsigned 
 long off, void *buf,
+                    unsigned long len, bool flush)
   {
-    return NULL;
   }

  #endif /* CONFIG_NET */

#3 lore raw
In reply to [email protected]
This patch was applied to bpf/bpf-next.git (master) by Martin KaFai Lau <[email protected]>:

Hello:

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

Quoted 8 lines · On Thu, 3 Aug 2023 17:51:01 -0700 you wrote:

From: Kui-Feng Lee <[email protected]>

Fix inconsistent return types in two implementations of bpf_xdp_copy_buf().

There are two implementations: one is an empty implementation whose return type does not match the actual implementation.

[...]

Here is the summary with links:
- [bpf-next] bpf: fix inconsistent return types of bpf_xdp_copy_buf().

    https://git.kernel.org/bpf/bpf-next/c/8a60a041eada

You are awesome, thank you!

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