Skip to content

Commit

Permalink
validation: dma: fix packet length when using segmented packets
Browse files Browse the repository at this point in the history
When testing DMA transfers with potentially segmented packets, ensure
that allocated packet length does not exceed allocated transfer
destination memory size.

Signed-off-by: Tuomas Taipale <tuomas.taipale@nokia.com>
Reviewed-by: Matias Elo <matias.elo@nokia.com>
  • Loading branch information
TuomasTaipale committed Oct 30, 2023
1 parent d51b28d commit 5b14808
Showing 1 changed file with 1 addition and 4 deletions.
5 changes: 1 addition & 4 deletions test/validation/api/dma/dma.c
Original file line number Diff line number Diff line change
Expand Up @@ -1108,7 +1108,7 @@ static void test_dma_pkt_segs_to_addr_sync(void)
uint8_t *dst;
odp_packet_t pkt;
uint32_t i, len, num_segs;
uint32_t pkt_len = global.pkt_len;
uint32_t pkt_len = ODPH_MIN(global.pkt_len, global.len);

memset(global.dst_addr, 0, global.data_size);

Expand All @@ -1128,9 +1128,6 @@ static void test_dma_pkt_segs_to_addr_sync(void)
CU_ASSERT_FATAL(odp_packet_copy_from_mem(pkt, 0, pkt_len, global.src_addr) == 0);

len = pkt_len - OFFSET - TRAILER;
if (len > global.len)
len = global.len;

dst = global.dst_addr + OFFSET;

memset(&src_seg, 0, sizeof(odp_dma_seg_t));
Expand Down

0 comments on commit 5b14808

Please sign in to comment.