* [PATCH] hw/rdma/vmw/pvrdma_dev_ring: Replace strncpy with pstrcpy
@ 2020-03-18 13:48 Julia Suvorova
2020-03-20 11:49 ` Yuval Shaia
2020-03-20 15:20 ` Stefan Hajnoczi
0 siblings, 2 replies; 4+ messages in thread
From: Julia Suvorova @ 2020-03-18 13:48 UTC (permalink / raw)
To: qemu-devel; +Cc: qemu-trivial, Julia Suvorova, Yuval Shaia
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>
---
hw/rdma/vmw/pvrdma_dev_ring.c | 4 ++--
1 file 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;
--
2.24.1
^ permalink raw reply related [flat|nested] 4+ messages in thread
* Re: [PATCH] hw/rdma/vmw/pvrdma_dev_ring: Replace strncpy with pstrcpy
2020-03-18 13:48 [PATCH] hw/rdma/vmw/pvrdma_dev_ring: Replace strncpy with pstrcpy Julia Suvorova
@ 2020-03-20 11:49 ` Yuval Shaia
2020-03-20 15:20 ` Stefan Hajnoczi
1 sibling, 0 replies; 4+ messages in thread
From: Yuval Shaia @ 2020-03-20 11:49 UTC (permalink / raw)
To: Julia Suvorova; +Cc: qemu-trivial, qemu-devel
[-- Attachment #1: Type: text/plain, Size: 1199 bytes --]
Thanks,
Reviewed-by: Yuval Shaia <yuval.shaia.ml.gmail.com>
On Wed, 18 Mar 2020 at 15:49, Julia Suvorova <jusual@redhat.com> wrote:
> 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>
> ---
> hw/rdma/vmw/pvrdma_dev_ring.c | 4 ++--
> 1 file 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;
> --
> 2.24.1
>
>
[-- Attachment #2: Type: text/html, Size: 1810 bytes --]
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH] hw/rdma/vmw/pvrdma_dev_ring: Replace strncpy with pstrcpy
2020-03-18 13:48 [PATCH] hw/rdma/vmw/pvrdma_dev_ring: Replace strncpy with pstrcpy Julia Suvorova
2020-03-20 11:49 ` Yuval Shaia
@ 2020-03-20 15:20 ` Stefan Hajnoczi
2020-03-20 17:30 ` Julia Suvorova
1 sibling, 1 reply; 4+ messages in thread
From: Stefan Hajnoczi @ 2020-03-20 15:20 UTC (permalink / raw)
To: Julia Suvorova; +Cc: qemu-trivial, qemu-devel, Yuval Shaia
[-- Attachment #1: Type: text/plain, Size: 565 bytes --]
On Wed, Mar 18, 2020 at 02:48:49PM +0100, Julia Suvorova wrote:
> 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>
> ---
> hw/rdma/vmw/pvrdma_dev_ring.c | 4 ++--
> 1 file changed, 2 insertions(+), 2 deletions(-)
Here is my equivalent patch
<20200316160702.478964-3-stefanha@redhat.com> but feel free to merge
this.
Reviewed-by: Stefan Hajnoczi <stefanha@redhat.com>
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 488 bytes --]
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH] hw/rdma/vmw/pvrdma_dev_ring: Replace strncpy with pstrcpy
2020-03-20 15:20 ` Stefan Hajnoczi
@ 2020-03-20 17:30 ` Julia Suvorova
0 siblings, 0 replies; 4+ messages in thread
From: Julia Suvorova @ 2020-03-20 17:30 UTC (permalink / raw)
To: Stefan Hajnoczi; +Cc: qemu-trivial, QEMU Developers, Yuval Shaia
On Fri, Mar 20, 2020 at 4:20 PM Stefan Hajnoczi <stefanha@gmail.com> wrote:
>
> On Wed, Mar 18, 2020 at 02:48:49PM +0100, Julia Suvorova wrote:
> > 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>
> > ---
> > hw/rdma/vmw/pvrdma_dev_ring.c | 4 ++--
> > 1 file changed, 2 insertions(+), 2 deletions(-)
>
> Here is my equivalent patch
> <20200316160702.478964-3-stefanha@redhat.com> but feel free to merge
> this.
Oops, sorry, I guess I didn't search carefully enough for the solution.
> Reviewed-by: Stefan Hajnoczi <stefanha@redhat.com>
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2020-03-20 17:30 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-03-18 13:48 [PATCH] hw/rdma/vmw/pvrdma_dev_ring: Replace strncpy with pstrcpy Julia Suvorova
2020-03-20 11:49 ` Yuval Shaia
2020-03-20 15:20 ` Stefan Hajnoczi
2020-03-20 17:30 ` Julia Suvorova
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).