Skip to content

Commit

Permalink
fix dump memory units overlap
Browse files Browse the repository at this point in the history
  • Loading branch information
saushew authored and taitov committed Dec 1, 2023
1 parent 6941fbc commit fd41278
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions dataplane/sharedmemory.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -25,10 +25,11 @@ void cSharedMemory::write(rte_mbuf* mbuf)

dataplane::metadata* metadata = YADECAP_METADATA(mbuf);

item->header.tag = metadata->hash;
item->header.size = mbuf->data_len;
uint64_t memory_size = buffer.unit_size - sizeof(cSharedMemory::ring_header_t);
uint64_t copy_size = RTE_MIN(memory_size, mbuf->data_len);

uint64_t copy_size = RTE_MIN(buffer.unit_size, mbuf->data_len);
item->header.size = copy_size;
item->header.tag = metadata->hash;

memcpy(item->memory,
rte_pktmbuf_mtod(mbuf, void*),
Expand Down

0 comments on commit fd41278

Please sign in to comment.