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>
This commit is contained in:
parent
52a96afaa2
commit
1d2695ef02
@ -16,6 +16,7 @@
|
|||||||
#include "qemu/osdep.h"
|
#include "qemu/osdep.h"
|
||||||
#include "hw/pci/pci.h"
|
#include "hw/pci/pci.h"
|
||||||
#include "cpu.h"
|
#include "cpu.h"
|
||||||
|
#include "qemu/cutils.h"
|
||||||
|
|
||||||
#include "trace.h"
|
#include "trace.h"
|
||||||
|
|
||||||
@ -30,8 +31,7 @@ int pvrdma_ring_init(PvrdmaRing *ring, const char *name, PCIDevice *dev,
|
|||||||
int i;
|
int i;
|
||||||
int rc = 0;
|
int rc = 0;
|
||||||
|
|
||||||
strncpy(ring->name, name, MAX_RING_NAME_SZ);
|
pstrcpy(ring->name, MAX_RING_NAME_SZ, name);
|
||||||
ring->name[MAX_RING_NAME_SZ - 1] = 0;
|
|
||||||
ring->dev = dev;
|
ring->dev = dev;
|
||||||
ring->ring_state = ring_state;
|
ring->ring_state = ring_state;
|
||||||
ring->max_elems = max_elems;
|
ring->max_elems = max_elems;
|
||||||
|
Loading…
Reference in New Issue
Block a user