summaryrefslogtreecommitdiffstats
path: root/hw/rdma/vmw
diff options
context:
space:
mode:
authorJulia Suvorova2020-03-18 14:48:49 +0100
committerMarcel Apfelbaum2020-03-21 18:13:12 +0100
commit1d2695ef02771f8adecf6b173ad7bcd8ddbaec67 (patch)
tree418edf0283f983ce5cceedb5088c18ebe26b904e /hw/rdma/vmw
parentMerge remote-tracking branch 'remotes/vivier2/tags/linux-user-for-5.0-pull-re... (diff)
downloadqemu-1d2695ef02771f8adecf6b173ad7bcd8ddbaec67.tar.gz
qemu-1d2695ef02771f8adecf6b173ad7bcd8ddbaec67.tar.xz
qemu-1d2695ef02771f8adecf6b173ad7bcd8ddbaec67.zip
hw/rdma/vmw/pvrdma_dev_ring: Replace strncpy with pstrcpy
ring->name is defined as 'char name[MAX_RING_NAME_SZ]'. Replace untruncated strncpy with QEMU function. This case prevented QEMU from compiling with --enable-sanitizers. Signed-off-by: Julia Suvorova <jusual@redhat.com> Message-Id: <20200318134849.237011-1-jusual@redhat.com> Reviewed-by: Yuval Shaia <yuval.shaia.ml.gmail.com> Reviewed-by: Stefan Hajnoczi <stefanha@redhat.com> Signed-off-by: Marcel Apfelbaum <marcel.apfelbaum@gmail.com>
Diffstat (limited to 'hw/rdma/vmw')
-rw-r--r--hw/rdma/vmw/pvrdma_dev_ring.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/hw/rdma/vmw/pvrdma_dev_ring.c b/hw/rdma/vmw/pvrdma_dev_ring.c
index d7bc7f5ccc..c2b3dd70a9 100644
--- a/hw/rdma/vmw/pvrdma_dev_ring.c
+++ b/hw/rdma/vmw/pvrdma_dev_ring.c
@@ -16,6 +16,7 @@
#include "qemu/osdep.h"
#include "hw/pci/pci.h"
#include "cpu.h"
+#include "qemu/cutils.h"
#include "trace.h"
@@ -30,8 +31,7 @@ int pvrdma_ring_init(PvrdmaRing *ring, const char *name, PCIDevice *dev,
int i;
int rc = 0;
- strncpy(ring->name, name, MAX_RING_NAME_SZ);
- ring->name[MAX_RING_NAME_SZ - 1] = 0;
+ pstrcpy(ring->name, MAX_RING_NAME_SZ, name);
ring->dev = dev;
ring->ring_state = ring_state;
ring->max_elems = max_elems;