Skip to content
Snippets Groups Projects
  1. Jul 21, 2015
  2. Jul 20, 2015
  3. Jul 17, 2015
  4. Jul 16, 2015
    • Peter Maydell's avatar
      b4329bf4
    • Peter Maydell's avatar
      Merge remote-tracking branch 'remotes/bonzini/tags/for-upstream' into staging · b92304ee
      Peter Maydell authored
      
      * MIPS-KVM fixes.
      * Coverity fixes.
      * Nettle function prototype fixes.
      * Memory API refcount fix.
      
      # gpg: Signature made Thu Jul 16 19:01:27 2015 BST using RSA key ID 78C7AE83
      # gpg: Good signature from "Paolo Bonzini <bonzini@gnu.org>"
      # gpg:                 aka "Paolo Bonzini <pbonzini@redhat.com>"
      # 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: 46F5 9FBD 57D6 12E7 BFD4  E2F7 7E15 100C CD36 69B1
      #      Subkey fingerprint: F133 3857 4B66 2389 866C  7682 BFFB D25F 78C7 AE83
      
      * remotes/bonzini/tags/for-upstream:
        crypto: avoid undefined behavior in nettle calls
        crypto: fix build with nettle >= 3.0.0
        memory: fix refcount leak in memory_region_present
        RDMA: Fix error exits
        arm/xlnx-zynqmp: fix memory leak
        ppc/spapr_drc: fix memory leak
        mips/kvm: Sign extend registers written to KVM
        mips/kvm: Fix Big endian 32-bit register access
      
      Signed-off-by: default avatarPeter Maydell <peter.maydell@linaro.org>
      b92304ee
    • Radim Krčmář's avatar
      crypto: avoid undefined behavior in nettle calls · d3462e37
      Radim Krčmář authored
      
      Calling a function pointer that was cast from an incompatible function
      results in undefined behavior.  'void *' isn't compatible with 'struct
      XXX *', so we can't cast to nettle_cipher_func, but have to provide a
      wrapper.  (Conversion from 'void *' to 'struct XXX *' might require
      computation, which won't be done if we drop argument's true type, and
      pointers can have different sizes so passing arguments on stack would
      bug.)
      
      Having two different prototypes based on nettle version doesn't make
      this solution any nicer.
      
      Reported-by: default avatarPeter Maydell <peter.maydell@linaro.org>
      Signed-off-by: default avatarRadim Krčmář <rkrcmar@redhat.com>
      Message-Id: <1437062641-12684-3-git-send-email-rkrcmar@redhat.com>
      Signed-off-by: default avatarPaolo Bonzini <pbonzini@redhat.com>
      d3462e37
    • Radim Krčmář's avatar
      crypto: fix build with nettle >= 3.0.0 · becaeb72
      Radim Krčmář authored
      
      In nettle 3, cbc_encrypt() accepts 'nettle_cipher_func' instead of
      'nettle_crypt_func' and these two differ in 'const' qualifier of the
      first argument.  The build fails with:
      
        In file included from crypto/cipher.c:71:0:
        ./crypto/cipher-nettle.c: In function ‘qcrypto_cipher_encrypt’:
        ./crypto/cipher-nettle.c:154:38: error: passing argument 2 of
        ‘nettle_cbc_encrypt’ from incompatible pointer type
                 cbc_encrypt(ctx->ctx_encrypt, ctx->alg_encrypt,
                                                     ^
        In file included from ./crypto/cipher-nettle.c:24:0,
                         from crypto/cipher.c:71:
        /usr/include/nettle/cbc.h:48:1: note: expected
        ‘void (*)(const void *, size_t, uint8_t *, const uint8_t *)
        but argument is of type
        ‘void (*)(      void *, size_t, uint8_t *, const uint8_t *)
      
      To allow both versions, we switch to the new definition and #if typedef
      it for old versions.
      
      Signed-off-by: default avatarRadim Krčmář <rkrcmar@redhat.com>
      Message-Id: <1436548682-9315-2-git-send-email-rkrcmar@redhat.com>
      Signed-off-by: default avatarPaolo Bonzini <pbonzini@redhat.com>
      becaeb72
    • Paolo Bonzini's avatar
      memory: fix refcount leak in memory_region_present · c6742b14
      Paolo Bonzini authored
      
      memory_region_present() leaks a reference to a MemoryRegion in the
      case "mr == container".  While fixing it, avoid reference counting
      altogether for memory_region_present(), by using RCU only.
      
      The return value could in principle be already invalid immediately
      after memory_region_present returns, but presumably the caller knows
      that and it's using memory_region_present to probe for devices that
      are unpluggable, or something like that.  The RCU critical section
      is needed anyway, because it protects as->current_map.
      
      Reported-by: default avatarPeter Maydell <peter.maydell@linaro.org>
      Signed-off-by: default avatarPaolo Bonzini <pbonzini@redhat.com>
      c6742b14
    • Dr. David Alan Gilbert's avatar
      RDMA: Fix error exits · 24b41d66
      Dr. David Alan Gilbert authored
      
      The error checks I added used 'break' after the error, but I'm
      in a switch inside the while loop, so they need to be 'goto out'.
      
      Spotted by coverity; entries 1311368 and 1311369
      
      Fixes: afcddefd
      
      Signed-off-by: default avatarDr. David Alan Gilbert <dgilbert@redhat.com>
      Message-Id: <1436555332-19076-1-git-send-email-dgilbert@redhat.com>
      Signed-off-by: default avatarPaolo Bonzini <pbonzini@redhat.com>
      24b41d66
    • Gonglei (Arei)'s avatar
      arm/xlnx-zynqmp: fix memory leak · 5348c62c
      Gonglei (Arei) authored
      
      fix CID 1311372.
      
      Signed-off-by: default avatarGonglei <arei.gonglei@huawei.com>
      Message-Id: <1436489490-236-4-git-send-email-arei.gonglei@huawei.com>
      Signed-off-by: default avatarPaolo Bonzini <pbonzini@redhat.com>
      5348c62c
Loading