[obv,AArch64,MTE] Fix inverted logic bug

Message ID 20210329170433.848926-1-luis.machado@linaro.org
State New
Headers show
Series
  • [obv,AArch64,MTE] Fix inverted logic bug
Related show

Commit Message

Simon Marchi via Gdb-patches March 29, 2021, 5:04 p.m.
During reviews, I changed the success/failure variables from int to bool, but
missed updating the code in a couple spots.  Given the logic inversion, the
gdbserver code fails instead of succeeding.

Fixed with the following patch. Seems fairly obvious, so I'll push it soon.

gdbserver/ChangeLog:

YYYY-MM-DD  Luis Machado  <luis.machado@linaro.org>

	* server.cc (handle_general_set, handle_query): Update variable
	to bool and fix verification logic.
---
 gdbserver/server.cc | 10 +++++-----
 1 file changed, 5 insertions(+), 5 deletions(-)

-- 
2.25.1

Patch

diff --git a/gdbserver/server.cc b/gdbserver/server.cc
index fd5e7808363..2a443305691 100644
--- a/gdbserver/server.cc
+++ b/gdbserver/server.cc
@@ -982,13 +982,13 @@  handle_general_set (char *own_buf)
 
       require_running_or_return (own_buf);
 
-      int ret = parse_store_memtags_request (own_buf, &addr, &len, tags,
+      bool ret = parse_store_memtags_request (own_buf, &addr, &len, tags,
 					     &type);
 
-      if (ret == 0)
+      if (ret)
 	ret = the_target->store_memtags (addr, len, tags, type);
 
-      if (ret)
+      if (!ret)
 	write_enn (own_buf);
       else
 	write_ok (own_buf);
@@ -2730,12 +2730,12 @@  handle_query (char *own_buf, int packet_len, int *new_packet_len_p)
 
       parse_fetch_memtags_request (own_buf, &addr, &len, &type);
 
-      int ret = the_target->fetch_memtags (addr, len, tags, type);
+      bool ret = the_target->fetch_memtags (addr, len, tags, type);
 
       if (ret)
 	ret = create_fetch_memtags_reply (own_buf, tags);
 
-      if (ret)
+      if (!ret)
 	write_enn (own_buf);
 
       *new_packet_len_p = strlen (own_buf);