From: Li Qiang <liq3ea@163.com>
To: mst@redhat.com, pbonzini@redhat.com
Cc: Li Qiang <liq3ea@163.com>, liq3ea@gmail.com, qemu-devel@nongnu.org
Subject: [Qemu-devel] [PATCH] hw: intel_iommu: initialize 'name' in vtd_find_add_as
Date: Thu, 1 Aug 2019 09:28:20 -0700 [thread overview]
Message-ID: <20190801162820.11238-1-liq3ea@163.com> (raw)
The 'name' variable in vtd_find_add_as function is not initialized
now, so when in gdb, we will got following output:
(gdb) p name
$1 = "vtd-00.0\000\000\000\000\000\000\000\000\060\330\377\377\377\177\000\000\001\000\000\000\000\000\000\000p\330\377\377\377\177\000\000\353\362\372VUU\000\000p\330\377\377\377\177\000\000 \000\000\060b\000\000\220\021\000\000\360a\000\000\200\"\002\000\020a\000\000 \000\000\060b\000\000\200\332\377\377\377\177\000\000\240\330\377\377\377\177\000\000<\364\372VUU\000\000\000\000\000\000\000\000\000\000 \000\000\060b\000"
After this patch, it is more clear:
(gdb) p name
$1 = "vtd-00.0", '\000' <repeats 119 times>
Signed-off-by: Li Qiang <liq3ea@163.com>
---
hw/i386/intel_iommu.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/hw/i386/intel_iommu.c b/hw/i386/intel_iommu.c
index de86f53b4e..e379c2a512 100644
--- a/hw/i386/intel_iommu.c
+++ b/hw/i386/intel_iommu.c
@@ -3286,7 +3286,7 @@ VTDAddressSpace *vtd_find_add_as(IntelIOMMUState *s, PCIBus *bus, int devfn)
uintptr_t key = (uintptr_t)bus;
VTDBus *vtd_bus = g_hash_table_lookup(s->vtd_as_by_busptr, &key);
VTDAddressSpace *vtd_dev_as;
- char name[128];
+ char name[128] = {};
if (!vtd_bus) {
uintptr_t *new_key = g_malloc(sizeof(*new_key));
--
2.17.1
next reply other threads:[~2019-08-01 16:29 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-08-01 16:28 Li Qiang [this message]
2019-08-02 10:51 ` [Qemu-devel] [PATCH] hw: intel_iommu: initialize 'name' in vtd_find_add_as Paolo Bonzini
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=20190801162820.11238-1-liq3ea@163.com \
--to=liq3ea@163.com \
--cc=liq3ea@gmail.com \
--cc=mst@redhat.com \
--cc=pbonzini@redhat.com \
--cc=qemu-devel@nongnu.org \
/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).