瀏覽代碼

totempg: Fix corrupted messages

Commit 54f1f1bdbf6202da12581abb0f6543a0a6b9e7fd changed copy_len
to iovec[i].iov_len, assuming,
copy_len is always the same as iovec[i].iov_len under those
circumstances, but it missed the possability of small message being
partly put at the end of packet, which cuts this message in two parts
and therefore making copy_len not equal to iovec[i].iov_len.

This is revert of 54f1f1bdbf6202da12581abb0f6543a0a6b9e7fd

(backported from master 105f3ae98c06f6a9ca4b5d5a9c1ea6d025115b79)

Signed-off-by: Rytis Karpuška <rytisk@neurotechnology.com>
Reviewed-by: Jan Friesse <jfriesse@redhat.com>
Rytis Karpuška 8 年之前
父節點
當前提交
646c0d0dfa
共有 1 個文件被更改,包括 3 次插入3 次删除
  1. 3 3
      exec/totempg.c

+ 3 - 3
exec/totempg.c

@@ -919,9 +919,9 @@ static int mcast_msg (
 			(max_packet_size - sizeof (unsigned short))) {
 
 			memcpy (&fragmentation_data[fragment_size],
-				(char *)iovec[i].iov_base + copy_base, iovec[i].iov_len);
-			fragment_size += iovec[i].iov_len;
-			mcast_packed_msg_lens[mcast_packed_msg_count] += iovec[i].iov_len;
+				(char *)iovec[i].iov_base + copy_base, copy_len);
+			fragment_size += copy_len;
+			mcast_packed_msg_lens[mcast_packed_msg_count] += copy_len;
 			next_fragment = 1;
 			copy_len = 0;
 			copy_base = 0;