* [PATCH] nvme-tcp: replace sg_init_marker() with sg_init_table()
@ 2022-10-22 17:46 Nam Cao
2022-10-23 7:48 ` Sagi Grimberg
` (2 more replies)
0 siblings, 3 replies; 5+ messages in thread
From: Nam Cao @ 2022-10-22 17:46 UTC (permalink / raw)
To: kbusch, axboe, hch, sagi; +Cc: namcaov, linux-nvme, linux-kernel
In nvme_tcp_ddgst_update(), sg_init_marker() is called with an
uninitialized scatterlist. This is probably fine, but gcc complains:
CC [M] drivers/nvme/host/tcp.o
In file included from ./include/linux/dma-mapping.h:10,
from ./include/linux/skbuff.h:31,
from ./include/net/net_namespace.h:43,
from ./include/linux/netdevice.h:38,
from ./include/net/sock.h:46,
from drivers/nvme/host/tcp.c:12:
In function ‘sg_mark_end’,
inlined from ‘sg_init_marker’ at ./include/linux/scatterlist.h:356:2,
inlined from ‘nvme_tcp_ddgst_update’ at drivers/nvme/host/tcp.c:390:2:
./include/linux/scatterlist.h:234:11: error: ‘sg.page_link’ is used uninitialized [-Werror=uninitialized]
234 | sg->page_link |= SG_END;
| ~~^~~~~~~~~~~
drivers/nvme/host/tcp.c: In function ‘nvme_tcp_ddgst_update’:
drivers/nvme/host/tcp.c:388:28: note: ‘sg’ declared here
388 | struct scatterlist sg;
| ^~
cc1: all warnings being treated as errors
Use sg_init_table() instead, which basically memset the scatterlist to
zero first before calling sg_init_marker().
Signed-off-by: Nam Cao <namcaov@gmail.com>
---
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 1eed0fc26b3a..dc2def86076d 100644
--- a/drivers/nvme/host/tcp.c
+++ b/drivers/nvme/host/tcp.c
@@ -387,7 +387,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
^ permalink raw reply related [flat|nested] 5+ messages in thread
* Re: [PATCH] nvme-tcp: replace sg_init_marker() with sg_init_table()
2022-10-22 17:46 [PATCH] nvme-tcp: replace sg_init_marker() with sg_init_table() Nam Cao
@ 2022-10-23 7:48 ` Sagi Grimberg
2022-10-25 0:58 ` Chaitanya Kulkarni
2022-10-25 15:10 ` Christoph Hellwig
2 siblings, 0 replies; 5+ messages in thread
From: Sagi Grimberg @ 2022-10-23 7:48 UTC (permalink / raw)
To: Nam Cao, kbusch, axboe, hch; +Cc: linux-nvme, linux-kernel
Reviewed-by: Sagi Grimberg <sagi@grimberg.me>
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH] nvme-tcp: replace sg_init_marker() with sg_init_table()
2022-10-22 17:46 [PATCH] nvme-tcp: replace sg_init_marker() with sg_init_table() Nam Cao
2022-10-23 7:48 ` Sagi Grimberg
@ 2022-10-25 0:58 ` Chaitanya Kulkarni
2022-10-25 9:30 ` Nam Cao
2022-10-25 15:10 ` Christoph Hellwig
2 siblings, 1 reply; 5+ messages in thread
From: Chaitanya Kulkarni @ 2022-10-25 0:58 UTC (permalink / raw)
To: Nam Cao; +Cc: linux-nvme, sagi, hch, axboe, kbusch, linux-kernel
On 10/22/22 10:46, Nam Cao wrote:
> In nvme_tcp_ddgst_update(), sg_init_marker() is called with an
> uninitialized scatterlist. This is probably fine, but gcc complains:
>
> CC [M] drivers/nvme/host/tcp.o
> In file included from ./include/linux/dma-mapping.h:10,
> from ./include/linux/skbuff.h:31,
> from ./include/net/net_namespace.h:43,
> from ./include/linux/netdevice.h:38,
> from ./include/net/sock.h:46,
> from drivers/nvme/host/tcp.c:12:
> In function ‘sg_mark_end’,
> inlined from ‘sg_init_marker’ at ./include/linux/scatterlist.h:356:2,
> inlined from ‘nvme_tcp_ddgst_update’ at drivers/nvme/host/tcp.c:390:2:
> ./include/linux/scatterlist.h:234:11: error: ‘sg.page_link’ is used uninitialized [-Werror=uninitialized]
> 234 | sg->page_link |= SG_END;
> | ~~^~~~~~~~~~~
> drivers/nvme/host/tcp.c: In function ‘nvme_tcp_ddgst_update’:
> drivers/nvme/host/tcp.c:388:28: note: ‘sg’ declared here
> 388 | struct scatterlist sg;
> | ^~
> cc1: all warnings being treated as errors
>
> Use sg_init_table() instead, which basically memset the scatterlist to
> zero first before calling sg_init_marker().
>
> Signed-off-by: Nam Cao <namcaov@gmail.com>
Looks good to me, can you please share what version if gcc you are
using ? my test setup did not catch this error and I'd like to update
with the one that can catch these errors.
Reviewed-by: Chaitanya Kulkarni <kch@nvidia.com>
-ck
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH] nvme-tcp: replace sg_init_marker() with sg_init_table()
2022-10-25 0:58 ` Chaitanya Kulkarni
@ 2022-10-25 9:30 ` Nam Cao
0 siblings, 0 replies; 5+ messages in thread
From: Nam Cao @ 2022-10-25 9:30 UTC (permalink / raw)
To: Chaitanya Kulkarni; +Cc: linux-nvme, sagi, hch, axboe, kbusch, linux-kernel
On Tue, Oct 25, 2022 at 12:58:41AM +0000, Chaitanya Kulkarni wrote:
> On 10/22/22 10:46, Nam Cao wrote:
> > In nvme_tcp_ddgst_update(), sg_init_marker() is called with an
> > uninitialized scatterlist. This is probably fine, but gcc complains:
> >
> > CC [M] drivers/nvme/host/tcp.o
> > In file included from ./include/linux/dma-mapping.h:10,
> > from ./include/linux/skbuff.h:31,
> > from ./include/net/net_namespace.h:43,
> > from ./include/linux/netdevice.h:38,
> > from ./include/net/sock.h:46,
> > from drivers/nvme/host/tcp.c:12:
> > In function ‘sg_mark_end’,
> > inlined from ‘sg_init_marker’ at ./include/linux/scatterlist.h:356:2,
> > inlined from ‘nvme_tcp_ddgst_update’ at drivers/nvme/host/tcp.c:390:2:
> > ./include/linux/scatterlist.h:234:11: error: ‘sg.page_link’ is used uninitialized [-Werror=uninitialized]
> > 234 | sg->page_link |= SG_END;
> > | ~~^~~~~~~~~~~
> > drivers/nvme/host/tcp.c: In function ‘nvme_tcp_ddgst_update’:
> > drivers/nvme/host/tcp.c:388:28: note: ‘sg’ declared here
> > 388 | struct scatterlist sg;
> > | ^~
> > cc1: all warnings being treated as errors
> >
> > Use sg_init_table() instead, which basically memset the scatterlist to
> > zero first before calling sg_init_marker().
> >
> > Signed-off-by: Nam Cao <namcaov@gmail.com>
>
> Looks good to me, can you please share what version if gcc you are
> using ? my test setup did not catch this error and I'd like to update
> with the one that can catch these errors.
It was just gcc12. But strange enough I cannot trigger this error again.
I was doing randconfig test build. Probably only a specific combination
of configs that can allow gcc to detect this...
And sorry but I was just start doing randconfig test and didn't think
about saving that .config file.
Best regards,
Nam
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH] nvme-tcp: replace sg_init_marker() with sg_init_table()
2022-10-22 17:46 [PATCH] nvme-tcp: replace sg_init_marker() with sg_init_table() Nam Cao
2022-10-23 7:48 ` Sagi Grimberg
2022-10-25 0:58 ` Chaitanya Kulkarni
@ 2022-10-25 15:10 ` Christoph Hellwig
2 siblings, 0 replies; 5+ messages in thread
From: Christoph Hellwig @ 2022-10-25 15:10 UTC (permalink / raw)
To: Nam Cao; +Cc: kbusch, axboe, hch, sagi, linux-nvme, linux-kernel
Thanks,
applied to nvme-6.1.
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2022-10-25 15:11 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-10-22 17:46 [PATCH] nvme-tcp: replace sg_init_marker() with sg_init_table() Nam Cao
2022-10-23 7:48 ` Sagi Grimberg
2022-10-25 0:58 ` Chaitanya Kulkarni
2022-10-25 9:30 ` Nam Cao
2022-10-25 15:10 ` Christoph Hellwig
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.