As len=0 in function of packet_alloc, the packet head will be initiated with
error params. pull_tail's result is replaced by packet_init.So we should do
packet_init before pull_tail as the length equal zero.

Signed-off-by: Zaibo Xu <[email protected]>
---
 platform/linux-generic/odp_packet.c | 7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)

diff --git a/platform/linux-generic/odp_packet.c 
b/platform/linux-generic/odp_packet.c
index db85b5e..567da81 100644
--- a/platform/linux-generic/odp_packet.c
+++ b/platform/linux-generic/odp_packet.c
@@ -104,8 +104,11 @@ odp_packet_t packet_alloc(odp_pool_t pool_hdl, uint32_t 
len, int parse)
 
                if (pkt == ODP_PACKET_INVALID)
                        return ODP_PACKET_INVALID;
-
-               pull_tail(odp_packet_hdr(pkt), len);
+               pkt_hdr = odp_packet_hdr(pkt);
+               packet_init(pool, pkt_hdr, len, parse);
+               pull_tail(pkt_hdr, len);
+               
+               return pkt;
 
        } else {
                pkt = (odp_packet_t)buffer_alloc(pool_hdl, len);
-- 
1.9.1

_______________________________________________
lng-odp mailing list
[email protected]
https://lists.linaro.org/mailman/listinfo/lng-odp

Reply via email to