qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] plugins: Ensure register handles are not NULL
@ 2024-02-29  9:28 Akihiko Odaki
  2024-05-31 16:26 ` Alex Bennée
  0 siblings, 1 reply; 2+ messages in thread
From: Akihiko Odaki @ 2024-02-29  9:28 UTC (permalink / raw)
  To: Alex Bennée, Alexandre Iooss, Mahmoud Mandour,
	Pierrick Bouvier
  Cc: qemu-devel, Akihiko Odaki

Ensure register handles are not NULL so that a plugin can assume NULL is
invalid as a register handle.

Signed-off-by: Akihiko Odaki <akihiko.odaki@daynix.com>
---
 plugins/api.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/plugins/api.c b/plugins/api.c
index 81f43c9ce8a4..74e24f0697cd 100644
--- a/plugins/api.c
+++ b/plugins/api.c
@@ -442,7 +442,7 @@ static GArray *create_register_handles(GArray *gdbstub_regs)
         }
 
         /* Create a record for the plugin */
-        desc.handle = GINT_TO_POINTER(grd->gdb_reg);
+        desc.handle = GINT_TO_POINTER(grd->gdb_reg + 1);
         desc.name = g_intern_string(grd->name);
         desc.feature = g_intern_string(grd->feature_name);
         g_array_append_val(find_data, desc);
@@ -463,5 +463,5 @@ int qemu_plugin_read_register(struct qemu_plugin_register *reg, GByteArray *buf)
 {
     g_assert(current_cpu);
 
-    return gdb_read_register(current_cpu, buf, GPOINTER_TO_INT(reg));
+    return gdb_read_register(current_cpu, buf, GPOINTER_TO_INT(reg) - 1);
 }

---
base-commit: bfe8020c814a30479a4241aaa78b63960655962b
change-id: 20240229-null-841efa023c93

Best regards,
-- 
Akihiko Odaki <akihiko.odaki@daynix.com>



^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH] plugins: Ensure register handles are not NULL
  2024-02-29  9:28 [PATCH] plugins: Ensure register handles are not NULL Akihiko Odaki
@ 2024-05-31 16:26 ` Alex Bennée
  0 siblings, 0 replies; 2+ messages in thread
From: Alex Bennée @ 2024-05-31 16:26 UTC (permalink / raw)
  To: Akihiko Odaki
  Cc: Alexandre Iooss, Mahmoud Mandour, Pierrick Bouvier, qemu-devel

Akihiko Odaki <akihiko.odaki@daynix.com> writes:

> Ensure register handles are not NULL so that a plugin can assume NULL is
> invalid as a register handle.
>
> Signed-off-by: Akihiko Odaki <akihiko.odaki@daynix.com>

Queued to plugins/next, thanks.

-- 
Alex Bennée
Virtualisation Tech Lead @ Linaro


^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2024-05-31 16:26 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-02-29  9:28 [PATCH] plugins: Ensure register handles are not NULL Akihiko Odaki
2024-05-31 16:26 ` Alex Bennée

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).