tg3: Use slab_build_skb() when needed
Subsystems (3)
PATCH 1/1 tg3: Use slab_build_skb() when needed
The tg3 driver will use kmalloc() under some conditions. Check the frag_size and use slab_build_skb() when frag_size is 0. Silences the warning introduced by commit ce098da1497c ("skbuff: Introduce slab_build_skb()"):
Use slab_build_skb() instead ... tg3_poll_work+0x638/0xf90 [tg3]
--- drivers/net/ethernet/broadcom/tg3.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-)
drivers/net/ethernet/broadcom/tg3.c +4 -1
@@ -6881,7 +6881,10 @@ static int tg3_rx(struct tg3_napi *tnapi, int budget) ri->data =NULL ; - skb =build_skb (data, frag_size); +if (frag_size) + skb =build_skb (data, frag_size); +else + skb =slab_build_skb (data);if (!skb) {tg3_frag_free (frag_size !=0 , data); goto drop_it_no_recycle;
Signature · 1 line
2.34.1
Quoted 43 lines · Kees Cook
The tg3 driver will use
kmalloc()under some conditions. Check thefrag_sizeand useslab_build_skb()whenfrag_sizeis 0. Silences the warning introduced by commitce098da1497c("skbuff: Introduceslab_build_skb()"):Use slab_build_skb() instead ... tg3_poll_work+0x638/0xf90 [tg3]Reported-by Fiona Ebner <[email protected]>Cc Siva Reddy Kallam <[email protected]>Cc Prashant Sreedharan <[email protected]>Cc Michael Chan <[email protected]>Cc "David S. Miller" <[email protected]>Cc Eric Dumazet <[email protected]>Cc Jakub Kicinski <[email protected]>Cc Paolo Abeni <[email protected]>Cc Bagas Sanjaya <[email protected]>Signed-off-by Kees Cook <[email protected]>--- drivers/net/ethernet/broadcom/tg3.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-)drivers/net/ethernet/broadcom/tg3.c +4
-2@@ -6881,7 +6881,10 @@ static int tg3_rx(struct tg3_napi *tnapi, int budget) ri->data =NULL ; - skb =build_skb (data, frag_size); +if (frag_size) + skb =build_skb (data, frag_size); +else + skb =slab_build_skb (data);if (!skb) {tg3_frag_free (frag_size !=0 , data); goto drop_it_no_recycle; --
Quoted 3 lines
2.34.1
Thanks. LGTM.
This patch was applied to netdev/net.git (main) by Jakub Kicinski <[email protected]>:
Hello:
This patch was applied to netdev/net.git (main)
by Jakub Kicinski <[email protected]>:
Quoted 10 lines · On Fri, 18 Aug 2023 10:54:21 -0700 you wrote:
The tg3 driver will use
kmalloc()under some conditions. Check thefrag_sizeand useslab_build_skb()whenfrag_sizeis 0. Silences the warning introduced by commitce098da1497c("skbuff: Introduceslab_build_skb()"):Use slab_build_skb() instead ... tg3_poll_work+0x638/0xf90 [tg3][...]
Here is the summary with links:
- tg3: Use slab_build_skb() when needed
https://git.kernel.org/netdev/net/c/99b415fe8986
You are awesome, thank you!
Signature · 2 lines
Deet-doot-dot, I am a bot. https://korg.docs.kernel.org/patchwork/pwbot.html