net/gve: fix pointers dereference before null check
PATCH 1/1 net/gve: fix pointers dereference before null check
The pointers 'rxq' and 'txq' are dereferenced before the null check. Fixed the logic in this patch.
Fixes 4bec2d0b5572 ("net/gve: support queue operations")
Signed-off-by Junfeng Guo <[email protected]>
--- drivers/net/gve/gve_rx.c | 3 ++- drivers/net/gve/gve_tx.c | 3 ++- 2 files changed, 4 insertions(+), 2 deletions(-)
drivers/net/gve/gve_rx.c +2 -1
@@ -150,7 +150,7 @@ gve_rx_burst(void *rx_queue, struct rte_mbuf **rx_pkts, uint16_t nb_pkts)static inline void gve_reset_rxq (struct gve_rx_queue *rxq) { -struct rte_mbuf **sw_ring = rxq->sw_ring; +struct rte_mbuf **sw_ring;uint32_t size, i;if (rxq ==NULL ) {
@@ -166,6 +166,7 @@ gve_reset_rxq(struct gve_rx_queue *rxq)for (i =0 ; i < size; i++) ((volatile char *)rxq->rx_data_ring)[i] =0 ; + sw_ring = rxq->sw_ring;for (i =0 ; i < rxq->nb_rx_desc; i++) sw_ring[i] =NULL ;
drivers/net/gve/gve_tx.c +2 -1
@@ -463,7 +463,7 @@ gve_tx_burst(void *tx_queue, struct rte_mbuf **tx_pkts, uint16_t nb_pkts)static inline void gve_reset_txq (struct gve_tx_queue *txq) { -struct rte_mbuf **sw_ring = txq->sw_ring; +struct rte_mbuf **sw_ring;uint32_t size, i;if (txq ==NULL ) {
@@ -475,6 +475,7 @@ gve_reset_txq(struct gve_tx_queue *txq)for (i =0 ; i < size; i++) ((volatile char *)txq->tx_desc_ring)[i] =0 ; + sw_ring = txq->sw_ring;for (i =0 ; i < txq->nb_tx_desc; i++) { sw_ring[i] =NULL ;if (txq->is_gqi_qpl) {
Signature · 1 line
2.34.1
Quoted 7 lines · Junfeng Guo
The pointers 'rxq' and 'txq' are dereferenced before the null check. Fixed the logic in this patch.
Fixes 4bec2d0b5572 ("net/gve: support queue operations")Signed-off-by Junfeng Guo <[email protected]>
Reviewed-by Ferruh Yigit <[email protected]>
Applied to dpdk-next-net/main, thanks.