qemu-commits
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Qemu-commits] [qemu/qemu] 1d2695: hw/rdma/vmw/pvrdma_dev_ring: Replace


From: Peter Maydell
Subject: [Qemu-commits] [qemu/qemu] 1d2695: hw/rdma/vmw/pvrdma_dev_ring: Replace strncpy with ...
Date: Sat, 21 Mar 2020 15:45:14 -0700

  Branch: refs/heads/master
  Home:   https://github.com/qemu/qemu
  Commit: 1d2695ef02771f8adecf6b173ad7bcd8ddbaec67
      
https://github.com/qemu/qemu/commit/1d2695ef02771f8adecf6b173ad7bcd8ddbaec67
  Author: Julia Suvorova <address@hidden>
  Date:   2020-03-21 (Sat, 21 Mar 2020)

  Changed paths:
    M hw/rdma/vmw/pvrdma_dev_ring.c

  Log Message:
  -----------
  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 <address@hidden>
Message-Id: <address@hidden>
Reviewed-by: Yuval Shaia <yuval.shaia.ml.gmail.com>
Reviewed-by: Stefan Hajnoczi <address@hidden>
Signed-off-by: Marcel Apfelbaum <address@hidden>


  Commit: f23601515b61ffe23398079cbfd6be0b9b99ec02
      
https://github.com/qemu/qemu/commit/f23601515b61ffe23398079cbfd6be0b9b99ec02
  Author: Yuval Shaia <address@hidden>
  Date:   2020-03-21 (Sat, 21 Mar 2020)

  Changed paths:
    M hw/rdma/rdma_backend.c

  Log Message:
  -----------
  hw/rdma: Cosmetic change - no need for two sge arrays

The function build_host_sge_array uses two sge arrays, one for input and
one for output.
Since the size of the two arrays is the same, the function can write
directly to the given source array (i.e. input/output argument).

Signed-off-by: Yuval Shaia <address@hidden>
Reviewed-by: Marcel Apfelbaum <address@hidden>
Message-Id: <address@hidden>
Signed-off-by: Marcel Apfelbaum <address@hidden>


  Commit: b196d4f1d62dc0976fd3999ff753f94944fcb657
      
https://github.com/qemu/qemu/commit/b196d4f1d62dc0976fd3999ff753f94944fcb657
  Author: Yuval Shaia <address@hidden>
  Date:   2020-03-21 (Sat, 21 Mar 2020)

  Changed paths:
    M hw/rdma/rdma_backend.c
    M hw/rdma/rdma_backend.h
    M hw/rdma/rdma_rm.c

  Log Message:
  -----------
  hw/rdma: Skip data-path mr_id translation

With the change made in commit 68b89aee71 ("Utilize ibv_reg_mr_iova for
memory registration") the MR emulation is no longer needed in order to
translate the guest addresses into host addresses.
With that, the next obvious step is to skip entirely the processing in
data-path.
To accomplish this, return the backend's lkey to driver so we will not
need to do the emulated mr_id to backend mr_id translation in data-path.

The function build_host_sge_array is still called in data-path but only
for backward computability with statistics collection.

While there, as a cosmetic change to make the code cleaner - make one
copy of the function rdma_backend_create_mr and leave the redundant
guest_start argument in the legacy code.

Signed-off-by: Yuval Shaia <address@hidden>
Reviewed-by: Marcel Apfelbaum <address@hidden>
Message-Id: <address@hidden>
Signed-off-by: Marcel Apfelbaum <address@hidden>


  Commit: f93cfdc583d4c26b2a878642adf574e11909863c
      
https://github.com/qemu/qemu/commit/f93cfdc583d4c26b2a878642adf574e11909863c
  Author: Stefan Hajnoczi <address@hidden>
  Date:   2020-03-21 (Sat, 21 Mar 2020)

  Changed paths:
    M hw/rdma/vmw/pvrdma_dev_ring.c

  Log Message:
  -----------
  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 <address@hidden>
Reviewed-by: Juan Quintela <address@hidden>
Reviewed-by: Yuval Shaia <yuval.shaia.ml.gmail.com>
Message-Id: <address@hidden>
Signed-off-by: Marcel Apfelbaum <address@hidden>


  Commit: 7b1e7cb7c56fbf800ee952d0ef013422dcc5751b
      
https://github.com/qemu/qemu/commit/7b1e7cb7c56fbf800ee952d0ef013422dcc5751b
  Author: Peter Maydell <address@hidden>
  Date:   2020-03-21 (Sat, 21 Mar 2020)

  Changed paths:
    M hw/rdma/rdma_backend.c
    M hw/rdma/rdma_backend.h
    M hw/rdma/rdma_rm.c
    M hw/rdma/vmw/pvrdma_dev_ring.c

  Log Message:
  -----------
  Merge remote-tracking branch 'remotes/marcel/tags/rdma-pull-request' into 
staging

RDMA queue

* hw/rdma: fix gcc 9.2 warnings
* hw/rdma: eliminate data-path processing
* hw/rdma: Replace strncpy with pstrcpy

# gpg: Signature made Sat 21 Mar 2020 17:29:59 GMT
# gpg:                using RSA key 36D4C0F0CF2FE46D
# gpg: Good signature from "Marcel Apfelbaum <address@hidden>" [marginal]
# gpg:                 aka "Marcel Apfelbaum <address@hidden>" [marginal]
# gpg:                 aka "Marcel Apfelbaum <address@hidden>" [marginal]
# gpg: WARNING: This key is not certified with sufficiently trusted signatures!
# gpg:          It is not certain that the signature belongs to the owner.
# Primary key fingerprint: B1C6 3A57 F92E 08F2 640F  31F5 36D4 C0F0 CF2F E46D

* remotes/marcel/tags/rdma-pull-request:
  hw/rdma: avoid suspicious strncpy() use
  hw/rdma: Skip data-path mr_id translation
  hw/rdma: Cosmetic change - no need for two sge arrays
  hw/rdma/vmw/pvrdma_dev_ring: Replace strncpy with pstrcpy

Signed-off-by: Peter Maydell <address@hidden>


Compare: https://github.com/qemu/qemu/compare/a0e7c2d8ed6f...7b1e7cb7c56f



reply via email to

[Prev in Thread] Current Thread [Next in Thread]