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 <james.r.harris@intel.com>
Change-Id: Iff79d40694dab1afe128ccac0c7c7a28cd827a3d
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/16924
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Konrad Sztyber <konrad.sztyber@intel.com>
Reviewed-by: Aleksey Marchuk <alexeymar@nvidia.com>
This commit is contained in:
Jim Harris 2023-02-23 14:11:36 +00:00 committed by Tomasz Zawadzki
parent fed358a0e7
commit 4037f0671b

View File

@ -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);