queue_to_qentry doesn't do any validation of the queue handle so will
never return NULL and ends up returning an invalid pointer if passed
ODP_QUEUE_INVALID.

Signed-off-by: Stuart Haslam <stuart.has...@arm.com>
---
 platform/linux-generic/odp_packet_io.c | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/platform/linux-generic/odp_packet_io.c 
b/platform/linux-generic/odp_packet_io.c
index c523350..f527e45 100644
--- a/platform/linux-generic/odp_packet_io.c
+++ b/platform/linux-generic/odp_packet_io.c
@@ -322,11 +322,13 @@ int odp_pktio_send(odp_pktio_t id, odp_packet_t 
pkt_table[], unsigned len)
 int odp_pktio_inq_setdef(odp_pktio_t id, odp_queue_t queue)
 {
        pktio_entry_t *pktio_entry = get_entry(id);
-       queue_entry_t *qentry = queue_to_qentry(queue);
+       queue_entry_t *qentry;
 
-       if (pktio_entry == NULL || qentry == NULL)
+       if (pktio_entry == NULL || queue == ODP_QUEUE_INVALID)
                return -1;
 
+       qentry = queue_to_qentry(queue);
+
        if (qentry->s.type != ODP_QUEUE_TYPE_PKTIN)
                return -1;
 
-- 
2.1.1



_______________________________________________
lng-odp mailing list
lng-odp@lists.linaro.org
http://lists.linaro.org/mailman/listinfo/lng-odp

Reply via email to