]> git.baikalelectronics.ru Git - kernel.git/commitdiff
nvmet-tcp: fix data digest pointer calculation
authorVarun Prakash <varun@chelsio.com>
Mon, 25 Oct 2021 17:16:54 +0000 (22:46 +0530)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Tue, 2 Nov 2021 18:46:13 +0000 (19:46 +0100)
commit e790de54e94a7a15fb725b34724d41d41cbaa60c upstream.

exp_ddgst is of type __le32, &cmd->exp_ddgst + cmd->offset increases
&cmd->exp_ddgst by 4 * cmd->offset, fix this by type casting
&cmd->exp_ddgst to u8 *.

Fixes: 1d48c1a32831 ("nvmet-tcp: add NVMe over TCP target driver")
Signed-off-by: Varun Prakash <varun@chelsio.com>
Reviewed-by: Sagi Grimberg <sagi@grimberg.me>
Signed-off-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/nvme/target/tcp.c

index 2ae846297d7ca8c474fea0a888623102d1db8ba2..2f4e512bd449f355483e3c8855abad04a3b8a36d 100644 (file)
@@ -633,7 +633,7 @@ static int nvmet_try_send_ddgst(struct nvmet_tcp_cmd *cmd)
        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,
                .iov_len = NVME_TCP_DIGEST_LENGTH - cmd->offset
        };
        int ret;