[1/2] linux-gen: ipc_pktio: fix conversion from hdr to pkt

Message ID 20170227152119.29595-1-maxim.uvarov@linaro.org
State New
Headers show
Series
  • [1/2] linux-gen: ipc_pktio: fix conversion from hdr to pkt
Related show

Commit Message

Maxim Uvarov Feb. 27, 2017, 3:21 p.m.
commit:
    5ebc1243 linux-gen: packet: packet handle is hdr pointer
Changes odp_packet_t as it's relation to packet header. This
needed to be adjusted in ipc pktio also.

Signed-off-by: Maxim Uvarov <maxim.uvarov@linaro.org>

---
 platform/linux-generic/pktio/ipc.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

-- 
2.11.0.295.gd7dffce

Comments

Savolainen, Petri (Nokia - FI/Espoo) Feb. 27, 2017, 4 p.m. | #1
> -----Original Message-----

> From: lng-odp [mailto:lng-odp-bounces@lists.linaro.org] On Behalf Of Maxim

> Uvarov

> Sent: Monday, February 27, 2017 5:21 PM

> To: lng-odp@lists.linaro.org

> Subject: [lng-odp] [PATCH 1/2] linux-gen: ipc_pktio: fix conversion from

> hdr to pkt

> 

> commit:

>     5ebc1243 linux-gen: packet: packet handle is hdr pointer

> Changes odp_packet_t as it's relation to packet header. This

> needed to be adjusted in ipc pktio also.

> 

> Signed-off-by: Maxim Uvarov <maxim.uvarov@linaro.org>

> ---

>  platform/linux-generic/pktio/ipc.c | 2 +-

>  1 file changed, 1 insertion(+), 1 deletion(-)

> 

> diff --git a/platform/linux-generic/pktio/ipc.c b/platform/linux-

> generic/pktio/ipc.c

> index 377f20e6..39fa6bda 100644

> --- a/platform/linux-generic/pktio/ipc.c

> +++ b/platform/linux-generic/pktio/ipc.c

> @@ -409,7 +409,7 @@ static void _ipc_free_ring_packets(pktio_entry_t

> *pktio_entry, _ring_t *r)

>  			void *mbase = pktio_entry-

> >s.ipc.pool_mdata_base;

> 

>  			phdr = (void *)((uint8_t *)mbase +

> offsets[i]);

> -			pkt = (odp_packet_t)phdr-

> >buf_hdr.handle.handle;

> +			pkt = (odp_packet_t)(uintptr_t)phdr;



Should not cast outside of packet files. Casting caused the bug in the first place. It even built but obviously crashed when handle representation was changed.

I sent a fix for this and for similar casting case in TM.

-Petri

Patch hide | download patch | download mbox

diff --git a/platform/linux-generic/pktio/ipc.c b/platform/linux-generic/pktio/ipc.c
index 377f20e6..39fa6bda 100644
--- a/platform/linux-generic/pktio/ipc.c
+++ b/platform/linux-generic/pktio/ipc.c
@@ -409,7 +409,7 @@  static void _ipc_free_ring_packets(pktio_entry_t *pktio_entry, _ring_t *r)
 			void *mbase = pktio_entry->s.ipc.pool_mdata_base;
 
 			phdr = (void *)((uint8_t *)mbase + offsets[i]);
-			pkt = (odp_packet_t)phdr->buf_hdr.handle.handle;
+			pkt = (odp_packet_t)(uintptr_t)phdr;
 			odp_packet_free(pkt);
 		}
 	}