lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <aWpJf59eGSWkhY+y@lizhi-Precision-Tower-5810>
Date: Fri, 16 Jan 2026 09:21:51 -0500
From: Frank Li <Frank.li@....com>
To: Wei Fang <wei.fang@....com>
Cc: shenwei.wang@....com, xiaoning.wang@....com, andrew+netdev@...n.ch,
	davem@...emloft.net, edumazet@...gle.com, kuba@...nel.org,
	pabeni@...hat.com, ast@...nel.org, daniel@...earbox.net,
	hawk@...nel.org, john.fastabend@...il.com, sdf@...ichev.me,
	netdev@...r.kernel.org, linux-kernel@...r.kernel.org,
	imx@...ts.linux.dev, bpf@...r.kernel.org
Subject: Re: [PATCH v2 net-next 08/14] net: fec: remove unnecessary NULL
 pointer check when clearing TX BD ring

On Fri, Jan 16, 2026 at 03:40:21PM +0800, Wei Fang wrote:
> The tx_buf pointer will not NULL when its type is FEC_TXBUF_T_XDP_NDO or
> FEC_TXBUF_T_XDP_TX. If the type is FEC_TXBUF_T_SKB, dev_kfree_skb_any()
> will do NULL pointer check. So it is unnecessary to do NULL pointer check
> in fec_enet_bd_init() and fec_enet_tx_queue().
>
> Signed-off-by: Wei Fang <wei.fang@....com>
> ---
Reviewed-by: Frank Li <Frank.Li@....com>
>  drivers/net/ethernet/freescale/fec_main.c | 35 ++++++++---------------
>  1 file changed, 12 insertions(+), 23 deletions(-)
>
> diff --git a/drivers/net/ethernet/freescale/fec_main.c b/drivers/net/ethernet/freescale/fec_main.c
> index 52abeeb50dda..0e8947f163a8 100644
> --- a/drivers/net/ethernet/freescale/fec_main.c
> +++ b/drivers/net/ethernet/freescale/fec_main.c
> @@ -1032,24 +1032,19 @@ static void fec_enet_bd_init(struct net_device *dev)
>  							 fec32_to_cpu(bdp->cbd_bufaddr),
>  							 fec16_to_cpu(bdp->cbd_datlen),
>  							 DMA_TO_DEVICE);
> -				if (txq->tx_buf[i].buf_p)
> -					dev_kfree_skb_any(txq->tx_buf[i].buf_p);
> +				dev_kfree_skb_any(txq->tx_buf[i].buf_p);
>  			} else if (txq->tx_buf[i].type == FEC_TXBUF_T_XDP_NDO) {
> -				if (bdp->cbd_bufaddr)
> -					dma_unmap_single(&fep->pdev->dev,
> -							 fec32_to_cpu(bdp->cbd_bufaddr),
> -							 fec16_to_cpu(bdp->cbd_datlen),
> -							 DMA_TO_DEVICE);
> +				dma_unmap_single(&fep->pdev->dev,
> +						 fec32_to_cpu(bdp->cbd_bufaddr),
> +						 fec16_to_cpu(bdp->cbd_datlen),
> +						 DMA_TO_DEVICE);
>
> -				if (txq->tx_buf[i].buf_p)
> -					xdp_return_frame(txq->tx_buf[i].buf_p);
> +				xdp_return_frame(txq->tx_buf[i].buf_p);
>  			} else {
>  				struct page *page = txq->tx_buf[i].buf_p;
>
> -				if (page)
> -					page_pool_put_page(pp_page_to_nmdesc(page)->pp,
> -							   page, 0,
> -							   false);
> +				page_pool_put_page(pp_page_to_nmdesc(page)->pp,
> +						   page, 0, false);
>  			}
>
>  			txq->tx_buf[i].buf_p = NULL;
> @@ -1537,21 +1532,15 @@ fec_enet_tx_queue(struct net_device *ndev, u16 queue_id, int budget)
>
>  			if (txq->tx_buf[index].type == FEC_TXBUF_T_XDP_NDO) {
>  				xdpf = txq->tx_buf[index].buf_p;
> -				if (bdp->cbd_bufaddr)
> -					dma_unmap_single(&fep->pdev->dev,
> -							 fec32_to_cpu(bdp->cbd_bufaddr),
> -							 fec16_to_cpu(bdp->cbd_datlen),
> -							 DMA_TO_DEVICE);
> +				dma_unmap_single(&fep->pdev->dev,
> +						 fec32_to_cpu(bdp->cbd_bufaddr),
> +						 fec16_to_cpu(bdp->cbd_datlen),
> +						 DMA_TO_DEVICE);
>  			} else {
>  				page = txq->tx_buf[index].buf_p;
>  			}
>
>  			bdp->cbd_bufaddr = cpu_to_fec32(0);
> -			if (unlikely(!txq->tx_buf[index].buf_p)) {
> -				txq->tx_buf[index].type = FEC_TXBUF_T_SKB;
> -				goto tx_buf_done;
> -			}
> -
>  			frame_len = fec16_to_cpu(bdp->cbd_datlen);
>  		}
>
> --
> 2.34.1
>

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ