public inbox for linux-rdma@vger.kernel.org
 help / color / mirror / Atom feed
From: Dan Carpenter <dan.carpenter@linaro.org>
To: Raed Salem <raeds@nvidia.com>
Cc: linux-rdma@vger.kernel.org
Subject: [bug report] net/mlx5e: Implement PSP Tx data path
Date: Tue, 23 Sep 2025 16:50:18 +0300	[thread overview]
Message-ID: <aNKlmnAdq34R9WSt@stanley.mountain> (raw)

Hello Raed Salem,

Commit e5a1861a298e ("net/mlx5e: Implement PSP Tx data path") from
Sep 16, 2025 (linux-next), leads to the following Smatch static
checker warning:

    drivers/net/ethernet/mellanox/mlx5/core/en_tx.c:1012 mlx5i_sq_xmit()
    error: NULL dereference inside function 'mlx5e_txwqe_build_eseg_csum()'

    drivers/net/ethernet/mellanox/mlx5/core/en_tx.c:143 mlx5e_txwqe_build_eseg_csum()
    warn: variable dereferenced before check 'accel' (see line 125)

drivers/net/ethernet/mellanox/mlx5/core/en_tx.c
    978 void mlx5i_sq_xmit(struct mlx5e_txqsq *sq, struct sk_buff *skb,
    979                    struct mlx5_av *av, u32 dqpn, u32 dqkey, bool xmit_more)
    980 {
    981         struct mlx5e_tx_wqe_attr wqe_attr;
    982         struct mlx5e_tx_attr attr;
    983         struct mlx5i_tx_wqe *wqe;
    984 
    985         struct mlx5_wqe_datagram_seg *datagram;
    986         struct mlx5_wqe_ctrl_seg *cseg;
    987         struct mlx5_wqe_eth_seg  *eseg;
    988         struct mlx5_wqe_data_seg *dseg;
    989         struct mlx5e_tx_wqe_info *wi;
    990 
    991         struct mlx5e_sq_stats *stats = sq->stats;
    992         int num_dma;
    993         u16 pi;
    994 
    995         mlx5e_sq_xmit_prepare(sq, skb, NULL, &attr);
    996         mlx5i_sq_calc_wqe_attr(skb, &attr, &wqe_attr);
    997 
    998         pi = mlx5e_txqsq_get_next_pi(sq, wqe_attr.num_wqebbs);
    999         wqe = MLX5I_SQ_FETCH_WQE(sq, pi);
    1000 
    1001         stats->xmit_more += xmit_more;
    1002 
    1003         /* fill wqe */
    1004         wi       = &sq->db.wqe_info[pi];
    1005         cseg     = &wqe->ctrl;
    1006         datagram = &wqe->datagram;
    1007         eseg     = &wqe->eth;
    1008         dseg     =  wqe->data;
    1009 
    1010         mlx5i_txwqe_build_datagram(av, dqpn, dqkey, datagram);
    1011 
--> 1012         mlx5e_txwqe_build_eseg_csum(sq, skb, NULL, eseg);
                                                      ^^^^
The patch adds an unchecked dereference of this NULL pointer.  There are
other callers as well.

    1013 
    1014         eseg->mss = attr.mss;
    1015 
    1016         if (attr.ihs) {
    1017                 if (unlikely(attr.hopbyhop)) {

regards,
dan carpenter

                 reply	other threads:[~2025-09-23 13:50 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=aNKlmnAdq34R9WSt@stanley.mountain \
    --to=dan.carpenter@linaro.org \
    --cc=linux-rdma@vger.kernel.org \
    --cc=raeds@nvidia.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox