X-Git-Url: http://git.droids-corp.org/?a=blobdiff_plain;f=lib%2Flibrte_mbuf%2Frte_mbuf.c;h=8a456e5e64dfcf5307a8d8969a7e01ba8f19c024;hb=d659460a17afa28d4c7a37d492df47ab3ac542c7;hp=cd5794d4a5e5df8e127ae5bbe8e3c0c52deba746;hpb=545fa736b94bc4381bc9ddf4019184e8f8a9516a;p=dpdk.git diff --git a/lib/librte_mbuf/rte_mbuf.c b/lib/librte_mbuf/rte_mbuf.c index cd5794d4a5..8a456e5e64 100644 --- a/lib/librte_mbuf/rte_mbuf.c +++ b/lib/librte_mbuf/rte_mbuf.c @@ -22,7 +22,6 @@ #include #include #include -#include #include #include #include @@ -77,9 +76,9 @@ rte_pktmbuf_pool_init(struct rte_mempool *mp, void *opaque_arg) */ void rte_pktmbuf_init(struct rte_mempool *mp, - __attribute__((unused)) void *opaque_arg, + __rte_unused void *opaque_arg, void *_m, - __attribute__((unused)) unsigned i) + __rte_unused unsigned i) { struct rte_mbuf *m = _m; uint32_t mbuf_size, buf_len, priv_size; @@ -167,7 +166,7 @@ static void __rte_pktmbuf_init_extmem(struct rte_mempool *mp, void *opaque_arg, void *_m, - __attribute__((unused)) unsigned int i) + __rte_unused unsigned int i) { struct rte_mbuf *m = _m; struct rte_pktmbuf_extmem_init_ctx *ctx = opaque_arg; @@ -191,14 +190,14 @@ __rte_pktmbuf_init_extmem(struct rte_mempool *mp, ext_mem = ctx->ext_mem + ctx->ext; RTE_ASSERT(ctx->ext < ctx->ext_num); - RTE_ASSERT(ctx->off < ext_mem->buf_len); + RTE_ASSERT(ctx->off + ext_mem->elt_size <= ext_mem->buf_len); m->buf_addr = RTE_PTR_ADD(ext_mem->buf_ptr, ctx->off); m->buf_iova = ext_mem->buf_iova == RTE_BAD_IOVA ? RTE_BAD_IOVA : (ext_mem->buf_iova + ctx->off); ctx->off += ext_mem->elt_size; - if (ctx->off >= ext_mem->buf_len) { + if (ctx->off + ext_mem->elt_size > ext_mem->buf_len) { ctx->off = 0; ++ctx->ext; }