qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: "Daniel P. Berrangé" <berrange@redhat.com>
To: qemu-devel@nongnu.org
Cc: "Kevin Wolf" <kwolf@redhat.com>, "Tong Ho" <tong.ho@xilinx.com>,
	"Daniel P. Berrangé" <berrange@redhat.com>,
	qemu-block@nongnu.org, "Max Reitz" <mreitz@redhat.com>
Subject: [PULL 1/5] crypto: fix getter of a QCryptoSecret's property
Date: Thu,  7 May 2020 12:57:59 +0100	[thread overview]
Message-ID: <20200507115803.1122661-2-berrange@redhat.com> (raw)
In-Reply-To: <20200507115803.1122661-1-berrange@redhat.com>

From: Tong Ho <tong.ho@xilinx.com>

This fixes the condition-check done by the "loaded" property
getter, such that the property returns true even when the
secret is loaded by the 'file' option.

Signed-off-by: Tong Ho <tong.ho@xilinx.com>
Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
---
 crypto/secret.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/crypto/secret.c b/crypto/secret.c
index 1cf0ad0ce8..5fb6bbe59c 100644
--- a/crypto/secret.c
+++ b/crypto/secret.c
@@ -221,6 +221,7 @@ qcrypto_secret_prop_set_loaded(Object *obj,
         secret->rawlen = inputlen;
     } else {
         g_free(secret->rawdata);
+        secret->rawdata = NULL;
         secret->rawlen = 0;
     }
 }
@@ -231,7 +232,7 @@ qcrypto_secret_prop_get_loaded(Object *obj,
                                Error **errp G_GNUC_UNUSED)
 {
     QCryptoSecret *secret = QCRYPTO_SECRET(obj);
-    return secret->data != NULL;
+    return secret->rawdata != NULL;
 }
 
 
-- 
2.26.2



  reply	other threads:[~2020-05-07 12:00 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-05-07 11:57 [PULL 0/5] Misc crypto subsystem fixes Daniel P. Berrangé
2020-05-07 11:57 ` Daniel P. Berrangé [this message]
2020-05-07 11:58 ` [PULL 2/5] crypto/secret: fix inconsequential errors Daniel P. Berrangé
2020-05-07 11:58 ` [PULL 3/5] crypto: Redundant type conversion for AES_KEY pointer Daniel P. Berrangé
2020-05-07 11:58 ` [PULL 4/5] block: luks: better error message when creating too large files Daniel P. Berrangé
2020-05-07 11:58 ` [PULL 5/5] crypto: extend hash benchmark to cover more algorithms Daniel P. Berrangé
2020-05-07 15:21 ` [PULL 0/5] Misc crypto subsystem fixes Peter Maydell

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20200507115803.1122661-2-berrange@redhat.com \
    --to=berrange@redhat.com \
    --cc=kwolf@redhat.com \
    --cc=mreitz@redhat.com \
    --cc=qemu-block@nongnu.org \
    --cc=qemu-devel@nongnu.org \
    --cc=tong.ho@xilinx.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).