Thread (12 messages) 12 messages, 4 authors, 2021-10-28

Re: [PATCH] nvmet-tcp: fix data digest pointer calculation

From: Varun Prakash <varun@chelsio.com>
Date: 2021-10-28 10:50:12

On Thu, Oct 28, 2021 at 11:26:02AM +0300, Sagi Grimberg wrote:
quoted
quoted
quoted
quoted
quoted
quoted
diff --git a/drivers/nvme/target/tcp.c b/drivers/nvme/target/tcp.c
index 07ee347..d641bfa 100644
--- a/drivers/nvme/target/tcp.c
+++ b/drivers/nvme/target/tcp.c
@@ -702,7 +702,7 @@ static int nvmet_try_send_ddgst(struct nvmet_tcp_cmd *cmd, bool last_in_batch)
  	struct nvmet_tcp_queue *queue = cmd->queue;
  	struct msghdr msg = { .msg_flags = MSG_DONTWAIT };
  	struct kvec iov = {
-		.iov_base = &cmd->exp_ddgst + cmd->offset,
+		.iov_base = (u8 *)&cmd->exp_ddgst + cmd->offset,
Wouldn't be the better fix to divide cmd->offset by 4 instead of the
casts?  I can fix this up inline if that is ok.
Don't really mind, what makes it a better fix?
I generally prefer to avoid casts as they paper over bugs.
I'm fine either way.
cmd->offset can have value 0,1,2,3. cmd->offset / 4 will always be 0.
If 2 bytes of digest are transmitted in the first call to kernel_sendmsg()
then in the second call remaining 2 bytes has to be transmitted so data digest
buffer pointer should increase by 2 bytes.
Right, so let's just change the cast to (void *). Varun, can you respin
the patches?
Both the patches are already applied to nvme-5.15, should I send v2 or
create a new patch for u8 * -> void * change?
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help