Skip to content

Commit

Permalink
[rx] copy data into the defrag buffer only if we know the size of the…
Browse files Browse the repository at this point in the history
… frame

Signed-off-by: Fabio M. Di Nitto <fdinitto@redhat.com>
  • Loading branch information
fabbione committed Oct 15, 2019
1 parent 1338058 commit aeaffc8
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions libknet/threads_rx.c
Original file line number Diff line number Diff line change
Expand Up @@ -186,8 +186,10 @@ static int pckt_defrag(knet_handle_t knet_h, struct knet_header *inbuf, ssize_t
defrag_buf->frag_size = *len;
}

memmove(defrag_buf->buf + ((inbuf->khp_data_frag_seq - 1) * defrag_buf->frag_size),
inbuf->khp_data_userdata, *len);
if (defrag_buf->frag_size) {
memmove(defrag_buf->buf + ((inbuf->khp_data_frag_seq - 1) * defrag_buf->frag_size),
inbuf->khp_data_userdata, *len);
}

defrag_buf->frag_recv++;
defrag_buf->frag_map[inbuf->khp_data_frag_seq] = 1;
Expand Down

0 comments on commit aeaffc8

Please sign in to comment.