[PATCH] nvme-tcp: memset scatterlist before sg_init_marker it

Jackie Liu liu.yun at linux.dev
Sun Dec 19 18:54:39 PST 2021


From: Jackie Liu <liuyun01 at kylinos.cn>

sg_init_marker's sg need initialized, otherwise report:

[...]
In file included from ../include/linux/dma-mapping.h:10,
                 from ../include/linux/skbuff.h:31,
                 from ../include/net/net_namespace.h:39,
                 from ../include/linux/netdevice.h:37,
                 from ../include/net/sock.h:46,
                 from ../drivers/nvme/host/tcp.c:12:
../drivers/nvme/host/tcp.c: In function ‘nvme_tcp_ddgst_update’:
../include/linux/scatterlist.h:214:16: error: ‘sg.page_link’ is used uninitialized in this function [-Werror=uninitialized]
  214 |  sg->page_link |= SG_END;
      |                ^~
cc1: all warnings being treated as errors
make[4]: *** [../scripts/Makefile.build:287: drivers/nvme/host/tcp.o] Error 1
make[3]: *** [../scripts/Makefile.build:549: drivers/nvme/host] Error 2
make[2]: *** [../scripts/Makefile.build:549: drivers/nvme] Error 2
make[2]: *** Waiting for unfinished jobs....
[...]

Reported-by: k2ci <kernel-bot at kylinos.cn>
Signed-off-by: Jackie Liu <liuyun01 at kylinos.cn>
---
 drivers/nvme/host/tcp.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/nvme/host/tcp.c b/drivers/nvme/host/tcp.c
index 4ceb28675fdf..8fd8cbe23683 100644
--- a/drivers/nvme/host/tcp.c
+++ b/drivers/nvme/host/tcp.c
@@ -348,7 +348,7 @@ static inline void nvme_tcp_ddgst_update(struct ahash_request *hash,
 {
 	struct scatterlist sg;
 
-	sg_init_marker(&sg, 1);
+	sg_init_table(&sg, 1);
 	sg_set_page(&sg, page, len, off);
 	ahash_request_set_crypt(hash, &sg, NULL, len);
 	crypto_ahash_update(hash);
-- 
2.25.1




More information about the Linux-nvme mailing list