examples/fips_validation: fix buffer overflow
[dpdk.git] / lib / librte_ring / rte_ring_peek.h
index 9e7f4db..45f707d 100644 (file)
@@ -68,10 +68,13 @@ __rte_ring_do_enqueue_start(struct rte_ring *r, uint32_t n,
                n =  __rte_ring_hts_move_prod_head(r, n, behavior,
                        &head, &free);
                break;
+       case RTE_RING_SYNC_MT:
+       case RTE_RING_SYNC_MT_RTS:
        default:
                /* unsupported mode, shouldn't be here */
                RTE_ASSERT(0);
                n = 0;
+               free = 0;
        }
 
        if (free_space != NULL)
@@ -217,6 +220,8 @@ rte_ring_enqueue_elem_finish(struct rte_ring *r, const void *obj_table,
                        __rte_ring_enqueue_elems(r, tail, obj_table, esize, n);
                __rte_ring_hts_set_head_tail(&r->hts_prod, tail, n, 1);
                break;
+       case RTE_RING_SYNC_MT:
+       case RTE_RING_SYNC_MT_RTS:
        default:
                /* unsupported mode, shouldn't be here */
                RTE_ASSERT(0);
@@ -263,10 +268,13 @@ __rte_ring_do_dequeue_start(struct rte_ring *r, void *obj_table,
                n =  __rte_ring_hts_move_cons_head(r, n, behavior,
                        &head, &avail);
                break;
+       case RTE_RING_SYNC_MT:
+       case RTE_RING_SYNC_MT_RTS:
        default:
                /* unsupported mode, shouldn't be here */
                RTE_ASSERT(0);
                n = 0;
+               avail = 0;
        }
 
        if (n != 0)
@@ -414,6 +422,8 @@ rte_ring_dequeue_elem_finish(struct rte_ring *r, unsigned int n)
                n = __rte_ring_hts_get_tail(&r->hts_cons, &tail, n);
                __rte_ring_hts_set_head_tail(&r->hts_cons, tail, n, 0);
                break;
+       case RTE_RING_SYNC_MT:
+       case RTE_RING_SYNC_MT_RTS:
        default:
                /* unsupported mode, shouldn't be here */
                RTE_ASSERT(0);