net/ixgbe: add param check when tx_queue or rx_queqe is null
PATCH 1/1 net/ixgbe: add param check when tx_queue or rx_queqe is null
add param check when tx_queue or rx_queqe is null.
--- drivers/net/ixgbe/ixgbe_rxtx.c | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-)
drivers/net/ixgbe/ixgbe_rxtx.c +7 -4
@@ -2539,6 +2539,8 @@ static const struct ixgbe_txq_ops def_txq_ops = { void __rte_coldixgbe_set_tx_function (struct rte_eth_dev *dev,struct ixgbe_tx_queue *txq) { +if (txq ==NULL ) +return ;/* Use a simple Tx queue (no offloads, no multi segs) if possible */ if ((txq->offloads == 0) &&#ifdef RTE_LIB_SECURITY
@@ -4953,12 +4955,13 @@ ixgbe_set_rx_function(struct rte_eth_dev *dev)for (i =0 ; i < dev->data->nb_rx_queues; i++) {struct ixgbe_rx_queue *rxq = dev->data->rx_queues[i]; - - rxq->rx_using_sse = rx_using_sse; +if (rxq) { + rxq->rx_using_sse = rx_using_sse;#ifdef RTE_LIB_SECURITY - rxq->using_ipsec = !!(dev->data->dev_conf.rxmode.offloads & -RTE_ETH_RX_OFFLOAD_SECURITY ); + rxq->using_ipsec = !!(dev->data->dev_conf.rxmode.offloads & +RTE_ETH_RX_OFFLOAD_SECURITY );#endif + } } }
Signature · 1 line
2.44.0.windows.1
Quoted 2 lines · keivinwang
add param check when
tx_queueorrx_queqeis null.
Hi,
trying to get some context on this patch. Have you encountered a situation where there are actually NULL parameters getting passed to the functions, or where an rx queue is unexpectedly NULL? If so, while adding NULL checks is not a big issue in itself, the values being NULL may indicate a more serious underlying issue we need to investigate.
Quoted 1 line
Signed-off-by keivinwang <[email protected]>
For a sign-off, the general format is to have both firstname and second/family name given as separate words.
Thanks,
/Bruce
Quoted 9 lines
--- drivers/net/ixgbe/ixgbe_rxtx.c | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-)drivers/net/ixgbe/ixgbe_rxtx.c +0
-0
drivers/net/ixgbe/ixgbe_rxtx.c static const struct ixgbe_txq_ops def_txq_ops = { · line 2543
Quoted 5 lines
drivers/net/ixgbe/ixgbe_rxtx.c +2
-0@@ -2539,6 +2539,8 @@ static const struct ixgbe_txq_ops def_txq_ops = { void __rte_coldixgbe_set_tx_function (struct rte_eth_dev *dev,struct ixgbe_tx_queue *txq) { +if (txq ==NULL ) +return ;
Have you encountered a situation where this function can be given a null parameter?
drivers/net/ixgbe/ixgbe_rxtx.c ixgbe_set_rx_function(struct rte_eth_dev *dev) · line 4956
Quoted 8 lines
drivers/net/ixgbe/ixgbe_rxtx.c +0
-1/* Use a simple Tx queue (no offloads, no multi segs) if possible */ if ((txq->offloads == 0) &&#ifdef RTE_LIB_SECURITY @@ -4953,12 +4955,13 @@ ixgbe_set_rx_function(struct rte_eth_dev *dev)for (i =0 ; i < dev->data->nb_rx_queues; i++) {struct ixgbe_rx_queue *rxq = dev->data->rx_queues[i]; -
Similarly here, if nb_rx_queues == X, is it possible a queue between 0..X-1 to be NULL?
Quoted 11 lines
drivers/net/ixgbe/ixgbe_rxtx.c +5
-3- rxq->rx_using_sse = rx_using_sse; +if (rxq) { + rxq->rx_using_sse = rx_using_sse;#ifdef RTE_LIB_SECURITY - rxq->using_ipsec = !!(dev->data->dev_conf.rxmode.offloads & -RTE_ETH_RX_OFFLOAD_SECURITY ); + rxq->using_ipsec = !!(dev->data->dev_conf.rxmode.offloads & +RTE_ETH_RX_OFFLOAD_SECURITY );#endif + } }