public inbox for linux-nvme@lists.infradead.org
 help / color / mirror / Atom feed
From: Chaitanya Kulkarni <chaitanyak@nvidia.com>
To: Nam Cao <namcaov@gmail.com>
Cc: "linux-nvme@lists.infradead.org" <linux-nvme@lists.infradead.org>,
	"sagi@grimberg.me" <sagi@grimberg.me>, "hch@lst.de" <hch@lst.de>,
	"axboe@fb.com" <axboe@fb.com>,
	"kbusch@kernel.org" <kbusch@kernel.org>,
	"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH] nvme-tcp: replace sg_init_marker() with sg_init_table()
Date: Tue, 25 Oct 2022 00:58:41 +0000	[thread overview]
Message-ID: <810f1de0-769c-ce67-4ec6-007ce25acfe0@nvidia.com> (raw)
In-Reply-To: <20221022174635.15643-1-namcaov@gmail.com>

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


  parent reply	other threads:[~2022-10-25  0:58 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
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 [this message]
2022-10-25  9:30   ` Nam Cao
2022-10-25 15:10 ` Christoph Hellwig

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=810f1de0-769c-ce67-4ec6-007ce25acfe0@nvidia.com \
    --to=chaitanyak@nvidia.com \
    --cc=axboe@fb.com \
    --cc=hch@lst.de \
    --cc=kbusch@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-nvme@lists.infradead.org \
    --cc=namcaov@gmail.com \
    --cc=sagi@grimberg.me \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox