bnx2: Use kmalloc_size_roundup() to match ksize() usage
Subsystems (3)
PATCH v2 1/1 bnx2: Use kmalloc_size_roundup() to match ksize() usage
Round up allocations with kmalloc_size_roundup() so that build_skb()'s use of ksize() is always accurate and no special handling of the memory is needed by KASAN, UBSAN_BOUNDS, nor FORTIFY_SOURCE.
---
v2: use kmalloc_size_roundup() instead of replacing build_skb() argument
v1: https://lore.kernel.org/lkml/[email protected]/
--- drivers/net/ethernet/broadcom/bnx2.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-)
drivers/net/ethernet/broadcom/bnx2.c +3 -2
@@ -5415,8 +5415,9 @@ bnx2_set_rx_ring_size(struct bnx2 *bp, u32 size) bp->rx_buf_use_size = rx_size;/* hw alignment + build_skb() overhead*/ - bp->rx_buf_size =SKB_DATA_ALIGN (bp->rx_buf_use_size +BNX2_RX_ALIGN ) + -NET_SKB_PAD +SKB_DATA_ALIGN (sizeof (struct skb_shared_info )); + bp->rx_buf_size =kmalloc_size_roundup ( +SKB_DATA_ALIGN (bp->rx_buf_use_size +BNX2_RX_ALIGN ) + +NET_SKB_PAD +SKB_DATA_ALIGN (sizeof (struct skb_shared_info ))); bp->rx_jumbo_thresh = rx_size -BNX2_RX_OFFSET ; bp->rx_ring_size = size; bp->rx_max_ring =bnx2_find_max_ring (size,BNX2_MAX_RX_RINGS );
Signature · 1 line
2.34.1
This patch was applied to netdev/net-next.git (master) by Paolo Abeni <[email protected]>:
Hello:
This patch was applied to netdev/net-next.git (master) by Paolo Abeni <[email protected]>:
Quoted 13 lines · On Fri, 21 Oct 2022 19:10:47 -0700 you wrote:
Round up allocations with
kmalloc_size_roundup()so that build_skb()'s use ofksize()is always accurate and no special handling of the memory is needed by KASAN,UBSAN_BOUNDS, norFORTIFY_SOURCE.Cc Rasesh Mody <[email protected]>Cc "David S. Miller" <[email protected]>Cc Eric Dumazet <[email protected]>Cc Jakub Kicinski <[email protected]>Cc Paolo Abeni <[email protected]>Signed-off-by Kees Cook <[email protected]>
Quoted 1 line
[...]
Here is the summary with links:
- [v2] bnx2: Use kmalloc_size_roundup() to match ksize() usage
https://git.kernel.org/netdev/net-next/c/d6dd508080a3
You are awesome, thank you!
Signature · 2 lines
Deet-doot-dot, I am a bot. https://korg.docs.kernel.org/patchwork/pwbot.html