[PATCH rdma-core] verbs: Fix UD pingpong buffer validation

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Account for UD's 40 bytes offset when doing buffer validation.

Fixes: 099c5aa50bc8 ("libibverb/examples: Add command line option to enable buffer validation")
Cc: Yuval Shaia <yuval.shaia@xxxxxxxxxx>
Signed-off-by: Gal Pressman <galpress@xxxxxxxxxx>
---
 libibverbs/examples/ud_pingpong.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/libibverbs/examples/ud_pingpong.c b/libibverbs/examples/ud_pingpong.c
index a89fbe3148ad..fa1e59ab2cc9 100644
--- a/libibverbs/examples/ud_pingpong.c
+++ b/libibverbs/examples/ud_pingpong.c
@@ -747,7 +747,7 @@ int main(int argc, char *argv[])
 	if (servername) {
 		if (validate_buf)
 			for (int i = 0; i < size; i += page_size)
-				ctx->buf[i] = i / page_size % sizeof(char);
+				ctx->buf[i + 40] = i / page_size % sizeof(char);
 
 		if (pp_post_send(ctx, rem_dest->qpn)) {
 			fprintf(stderr, "Couldn't post send\n");
@@ -860,7 +860,8 @@ int main(int argc, char *argv[])
 
 		if ((!servername) && (validate_buf)) {
 			for (int i = 0; i < size; i += page_size)
-				if (ctx->buf[i] != i / page_size % sizeof(char))
+				if (ctx->buf[i + 40] !=
+				    i / page_size % sizeof(char))
 					printf("invalid data in page %d\n",
 					       i / page_size);
 		}
-- 
2.7.4




[Index of Archives]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Photo]     [Yosemite News]     [Yosemite Photos]     [Linux Kernel]     [Linux SCSI]     [XFree86]

  Powered by Linux