lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <810f1de0-769c-ce67-4ec6-007ce25acfe0@nvidia.com>
Date:   Tue, 25 Oct 2022 00:58:41 +0000
From:   Chaitanya Kulkarni <chaitanyak@...dia.com>
To:     Nam Cao <namcaov@...il.com>
CC:     "linux-nvme@...ts.infradead.org" <linux-nvme@...ts.infradead.org>,
        "sagi@...mberg.me" <sagi@...mberg.me>, "hch@....de" <hch@....de>,
        "axboe@...com" <axboe@...com>,
        "kbusch@...nel.org" <kbusch@...nel.org>,
        "linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>
Subject: Re: [PATCH] nvme-tcp: replace sg_init_marker() with sg_init_table()

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@...il.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@...dia.com>

-ck

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ