From 4037f0671b4759449a9f3f50dec3d397ef908f96 Mon Sep 17 00:00:00 2001 From: Jim Harris Date: Thu, 23 Feb 2023 14:11:36 +0000 Subject: [PATCH] sock/posix: don't add 1 to pipe size There's no need to add 1 to the pipe size, it actually results in unaligned accesses after we've cycled through the pipe buffer for the first time. Fixes: eb98488 ("sock/posix: Internally buffer reads.") Signed-off-by: Jim Harris Change-Id: Iff79d40694dab1afe128ccac0c7c7a28cd827a3d Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/16924 Tested-by: SPDK CI Jenkins Reviewed-by: Konrad Sztyber Reviewed-by: Aleksey Marchuk --- module/sock/posix/posix.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/module/sock/posix/posix.c b/module/sock/posix/posix.c index af064f57f..c8458db10 100644 --- a/module/sock/posix/posix.c +++ b/module/sock/posix/posix.c @@ -273,13 +273,13 @@ posix_sock_alloc_pipe(struct spdk_posix_sock *sock, int sz) } /* Round up to next 64 byte multiple */ - new_buf = calloc(SPDK_ALIGN_CEIL(sz + 1, 64), sizeof(uint8_t)); + new_buf = calloc(SPDK_ALIGN_CEIL(sz, 64), sizeof(uint8_t)); if (!new_buf) { SPDK_ERRLOG("socket recv buf allocation failed\n"); return -ENOMEM; } - new_pipe = spdk_pipe_create(new_buf, sz + 1); + new_pipe = spdk_pipe_create(new_buf, sz); if (new_pipe == NULL) { SPDK_ERRLOG("socket pipe allocation failed\n"); free(new_buf);