• Nam Cao's avatar
    nvme-tcp: replace sg_init_marker() with sg_init_table() · 5fa9add6
    Nam Cao authored
    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: default avatarNam Cao <namcaov@gmail.com>
    Reviewed-by: default avatarSagi Grimberg <sagi@grimberg.me>
    Reviewed-by: default avatarChaitanya Kulkarni <kch@nvidia.com>
    Signed-off-by: default avatarChristoph Hellwig <hch@lst.de>
    5fa9add6
tcp.c 67.7 KB