qemu/hw/rdma
Stefan Hajnoczi f93cfdc583 hw/rdma: avoid suspicious strncpy() use
gcc (GCC) 9.2.1 20190827 (Red Hat 9.2.1-1) with sanitizers enabled
reports the following error:

  CC      x86_64-softmmu/hw/rdma/vmw/pvrdma_dev_ring.o
In file included from /usr/include/string.h:495,
                 from include/qemu/osdep.h:101,
                 from hw/rdma/vmw/pvrdma_dev_ring.c:16:
In function ‘strncpy’,
    inlined from ‘pvrdma_ring_init’ at hw/rdma/vmw/pvrdma_dev_ring.c:33:5:
/usr/include/bits/string_fortified.h:106:10: error: ‘__builtin_strncpy’ specified bound 32 equals destination size [-Werror=stringop-truncation]
  106 |   return __builtin___strncpy_chk (__dest, __src, __len, __bos (__dest));
      |          ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

Use pstrcpy() instead of strncpy().  It is guaranteed to NUL-terminate
strings.

Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
Reviewed-by: Juan Quintela <quintela@redhat.com>
Reviewed-by: Yuval Shaia <yuval.shaia.ml.gmail.com>
Message-Id: <20200316160702.478964-3-stefanha@redhat.com>
Signed-off-by: Marcel Apfelbaum <marcel.apfelbaum@gmail.com>
2020-03-21 19:21:20 +02:00
..
vmw hw/rdma: avoid suspicious strncpy() use 2020-03-21 19:21:20 +02:00
Kconfig kconfig: add dependencies on CONFIG_MSI_NONBROKEN 2019-03-18 09:39:57 +01:00
Makefile.objs * Kconfig improvements (msi_nonbroken, imply for default PCI devices) 2019-03-28 09:18:53 +00:00
rdma_backend_defs.h hw/rdma: Add SRQ support to backend layer 2019-05-04 15:55:56 +03:00
rdma_backend.c hw/rdma: Skip data-path mr_id translation 2020-03-21 19:16:38 +02:00
rdma_backend.h hw/rdma: Skip data-path mr_id translation 2020-03-21 19:16:38 +02:00
rdma_rm_defs.h hw/rdma: Modify create/destroy QP to support SRQ 2019-05-04 15:55:56 +03:00
rdma_rm.c hw/rdma: Skip data-path mr_id translation 2020-03-21 19:16:38 +02:00
rdma_rm.h hw/rdma: Modify create/destroy QP to support SRQ 2019-05-04 15:55:56 +03:00
rdma_utils.c hw/rdma: Free all receive buffers when QP is destroyed 2019-03-16 15:52:44 +02:00
rdma_utils.h Use #include "..." for our own headers, <...> for others 2019-05-13 08:58:55 +02:00
rdma.c {hmp, hw/pvrdma}: Expose device internals via monitor interface 2019-03-16 15:52:44 +02:00
trace-events trace-events: Shorten file names in comments 2019-03-22 16:18:07 +00:00