Skip to contentSkip to conversation

xsk: fix clang build error in __xp_alloc

PATCH Applied Magnus Karlsson 3 participants 3 messages Sep 29, 2021

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

PATCH 1/1 xsk: fix clang build error in __xp_alloc

From: Magnus Karlsson <[email protected]>

Fix a build error with clang in __xp_alloc().

net/xdp/xsk_buff_pool.c:465:15: error: variable 'xskb' is uninitialized when used here [-Werror,-Wuninitialized]

                        xp_release(xskb);
                                   ^~~~

This is correctly detected by clang, but not gcc. In fact, the xp_release() statement should not be there at all in the refactored code, so just remove it.

Fixes 94033cd8e73b ("xsk: Optimize for aligned case")
---
 net/xdp/xsk_buff_pool.c | 1 -
 1 file changed, 1 deletion(-)
net/xdp/xsk_buff_pool.c +0 -1
index 96b14e51ba7e..90c4e1e819d3 100644
@@ -462,7 +462,6 @@ static struct xdp_buff_xsk *__xp_alloc(struct xsk_buff_pool *pool)
 	for (;;) {
 		if (!xskq_cons_peek_addr_unchecked(pool->fq, &addr)) {
 			pool->fq->queue_empty_descs++;
-			xp_release(xskb);
 			return NULL;
 		}
 

base-commit: 72e1781a5de9e3ee804e24f7ce9a7dd85596fc51

Signature · 1 line
2.29.0
maintainer Acked-by on v1 1/1
#1 lore raw
Quoted 4 lines · Magnus Karlsson

From: Magnus Karlsson <[email protected]>

Fix a build error with clang in __xp_alloc().

Quoted 8 lines

net/xdp/xsk_buff_pool.c:465:15: error: variable 'xskb' is uninitialized when used here [-Werror,-Wuninitialized]

                        xp_release(xskb);
                                   ^~~~

This is correctly detected by clang, but not gcc. In fact, the xp_release() statement should not be there at all in the refactored code, so just remove it.

Quoted 25 lines
Fixes 94033cd8e73b ("xsk: Optimize for aligned case")
---
 net/xdp/xsk_buff_pool.c | 1 -
 1 file changed, 1 deletion(-)
net/xdp/xsk_buff_pool.c +0 -1
index 96b14e51ba7e..90c4e1e819d3 100644
@@ -462,7 +462,6 @@ static struct xdp_buff_xsk *__xp_alloc(struct xsk_buff_pool *pool)
 	for (;;) {
 		if (!xskq_cons_peek_addr_unchecked(pool->fq, &addr)) {
 			pool->fq->queue_empty_descs++;
-			xp_release(xskb);
 			return NULL;
 		}
 

base-commit: 72e1781a5de9e3ee804e24f7ce9a7dd85596fc51

Signature · 1 line
2.29.0
#2 lore raw
In reply to Magnus Karlsson
This patch was applied to bpf/bpf-next.git (refs/heads/master):

Hello:

This patch was applied to bpf/bpf-next.git (refs/heads/master):

Quoted 10 lines · On Wed, 29 Sep 2021 08:14:03 +0200 you wrote:

From: Magnus Karlsson <[email protected]>

Fix a build error with clang in __xp_alloc().

net/xdp/xsk_buff_pool.c:465:15: error: variable 'xskb' is uninitialized when used here [-Werror,-Wuninitialized]

                        xp_release(xskb);
                                   ^~~~

[...]

Here is the summary with links:
- [bpf-next] xsk: fix clang build error in __xp_alloc

    https://git.kernel.org/bpf/bpf-next/c/3103836496e7

You are awesome, thank you!
--
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html