Commit 4037f067 authored by Jim Harris's avatar Jim Harris Committed by Tomasz Zawadzki
Browse files

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: eb984889 ("sock/posix: Internally buffer reads.")

Signed-off-by: default avatarJim Harris <james.r.harris@intel.com>
Change-Id: Iff79d40694dab1afe128ccac0c7c7a28cd827a3d
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/16924


Tested-by: default avatarSPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: default avatarKonrad Sztyber <konrad.sztyber@intel.com>
Reviewed-by: default avatarAleksey Marchuk <alexeymar@nvidia.com>
parent fed358a0
Loading
Loading
Loading
Loading
+2 −2
Original line number Diff line number Diff line
@@ -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);