This issue was reported by PVS studio, described as:
https://pvs-studio.com/en/docs/warnings/v656

Signed-off-by: Renyong Wan <wa...@yunsilicon.com>
---
 drivers/net/xsc/xsc_rx.c | 6 ++----
 1 file changed, 2 insertions(+), 4 deletions(-)

diff --git a/drivers/net/xsc/xsc_rx.c b/drivers/net/xsc/xsc_rx.c
index c031e56a94..ca832dab23 100644
--- a/drivers/net/xsc/xsc_rx.c
+++ b/drivers/net/xsc/xsc_rx.c
@@ -445,10 +445,8 @@ xsc_rxq_elts_alloc(struct xsc_rxq_data *rxq_data)
 
                mbuf->port = rxq_data->port_id;
                mbuf->nb_segs = 1;
-               rte_pktmbuf_data_len(mbuf) = 
rte_pktmbuf_data_room_size(rxq_data->mp)
-                                               - mbuf->data_off;
-               rte_pktmbuf_pkt_len(mbuf) = 
rte_pktmbuf_data_room_size(rxq_data->mp)
-                                               - mbuf->data_off;
+               rte_pktmbuf_data_len(mbuf) = mbuf->buf_len - mbuf->data_off;
+               rte_pktmbuf_pkt_len(mbuf) = rte_pktmbuf_data_len(mbuf);
                (*rxq_data->elts)[i] = mbuf;
        }
 
-- 
2.25.1

Reply via email to