All of lore.kernel.org
 help / color / mirror / Atom feed
From: AlexChen <alex.chen@huawei.com>
To: <stefanb@linux.vnet.ibm.com>, Thomas Huth <thuth@redhat.com>,
	<lvivier@redhat.com>, Paolo Bonzini <pbonzini@redhat.com>
Cc: QEMU <qemu-devel@nongnu.org>, <zhang.zhanghailiang@huawei.com>,
	"QEMU Trivial" <qemu-trivial@nongnu.org>
Subject: [PATCH] tests/qtest/tpm: Remove redundant check in the tpm_test_swtpm_test()
Date: Thu, 5 Nov 2020 23:03:36 +0800	[thread overview]
Message-ID: <5FA41448.4040404@huawei.com> (raw)

The 'addr' would not be NULL after checking 'succ' is valid,
and it has been dereferenced in the previous code(args = g_strdup_printf()).
So the check on 'addr' in the tpm_test_swtpm_test() is redundant. Remove it.

Reported-by: Euler Robot <euler.robot@huawei.com>
Signed-off-by: Alex Chen <alex.chen@huawei.com>
---
 tests/qtest/tpm-tests.c | 6 ++----
 1 file changed, 2 insertions(+), 4 deletions(-)

diff --git a/tests/qtest/tpm-tests.c b/tests/qtest/tpm-tests.c
index 70c80f8379..0da3a8a4df 100644
--- a/tests/qtest/tpm-tests.c
+++ b/tests/qtest/tpm-tests.c
@@ -70,10 +70,8 @@ void tpm_test_swtpm_test(const char *src_tpm_path, tx_func *tx,
     qtest_end();
     tpm_util_swtpm_kill(swtpm_pid);

-    if (addr) {
-        g_unlink(addr->u.q_unix.path);
-        qapi_free_SocketAddress(addr);
-    }
+    g_unlink(addr->u.q_unix.path);
+    qapi_free_SocketAddress(addr);
 }

 void tpm_test_swtpm_migration_test(const char *src_tpm_path,
-- 
2.19.1


WARNING: multiple messages have this Message-ID (diff)
From: AlexChen <alex.chen@huawei.com>
To: <stefanb@linux.vnet.ibm.com>, Thomas Huth <thuth@redhat.com>,
	<lvivier@redhat.com>, Paolo Bonzini <pbonzini@redhat.com>
Cc: QEMU Trivial <qemu-trivial@nongnu.org>,
	QEMU <qemu-devel@nongnu.org>,
	zhang.zhanghailiang@huawei.com
Subject: [PATCH] tests/qtest/tpm: Remove redundant check in the tpm_test_swtpm_test()
Date: Thu, 5 Nov 2020 23:03:36 +0800	[thread overview]
Message-ID: <5FA41448.4040404@huawei.com> (raw)

The 'addr' would not be NULL after checking 'succ' is valid,
and it has been dereferenced in the previous code(args = g_strdup_printf()).
So the check on 'addr' in the tpm_test_swtpm_test() is redundant. Remove it.

Reported-by: Euler Robot <euler.robot@huawei.com>
Signed-off-by: Alex Chen <alex.chen@huawei.com>
---
 tests/qtest/tpm-tests.c | 6 ++----
 1 file changed, 2 insertions(+), 4 deletions(-)

diff --git a/tests/qtest/tpm-tests.c b/tests/qtest/tpm-tests.c
index 70c80f8379..0da3a8a4df 100644
--- a/tests/qtest/tpm-tests.c
+++ b/tests/qtest/tpm-tests.c
@@ -70,10 +70,8 @@ void tpm_test_swtpm_test(const char *src_tpm_path, tx_func *tx,
     qtest_end();
     tpm_util_swtpm_kill(swtpm_pid);

-    if (addr) {
-        g_unlink(addr->u.q_unix.path);
-        qapi_free_SocketAddress(addr);
-    }
+    g_unlink(addr->u.q_unix.path);
+    qapi_free_SocketAddress(addr);
 }

 void tpm_test_swtpm_migration_test(const char *src_tpm_path,
-- 
2.19.1


             reply	other threads:[~2020-11-05 15:03 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-11-05 15:03 AlexChen [this message]
2020-11-05 15:03 ` [PATCH] tests/qtest/tpm: Remove redundant check in the tpm_test_swtpm_test() AlexChen
2020-11-05 15:57 ` Marc-André Lureau
2020-11-05 15:57   ` Marc-André Lureau
2020-11-09 11:28 ` Thomas Huth
2020-11-09 11:28   ` Thomas Huth

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=5FA41448.4040404@huawei.com \
    --to=alex.chen@huawei.com \
    --cc=lvivier@redhat.com \
    --cc=pbonzini@redhat.com \
    --cc=qemu-devel@nongnu.org \
    --cc=qemu-trivial@nongnu.org \
    --cc=stefanb@linux.vnet.ibm.com \
    --cc=thuth@redhat.com \
    --cc=zhang.zhanghailiang@huawei.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.