public inbox for gdb-patches@sourceware.org
 help / color / mirror / Atom feed
* [pushed] Fix compilation failure in remote.c
@ 2018-08-06 20:59 Simon Marchi
  2018-08-06 21:04 ` Pedro Franco de Carvalho
  0 siblings, 1 reply; 3+ messages in thread
From: Simon Marchi @ 2018-08-06 20:59 UTC (permalink / raw)
  To: gdb-patches; +Cc: Simon Marchi

A recent patch introduced a few of these:

/home/emaisin/src/binutils-gdb/gdb/remote.c:12862:19: error: format not a string literal and no format arguments [-Werror=format-security]
     error (err_msg);
                   ^

Fix them by replacing the call to error with

  error ("%s", err_msg);

gdb/ChangeLog:

	* remote.c (remote_target::download_tracepoint): Fix format
	string errors.
---
 gdb/ChangeLog |  5 +++++
 gdb/remote.c  | 20 ++++++++++----------
 2 files changed, 15 insertions(+), 10 deletions(-)

diff --git a/gdb/ChangeLog b/gdb/ChangeLog
index 03badaf..8fc9cab 100644
--- a/gdb/ChangeLog
+++ b/gdb/ChangeLog
@@ -1,3 +1,8 @@
+2018-08-06  Simon Marchi  <simon.marchi@ericsson.com>
+
+	* remote.c (remote_target::download_tracepoint): Fix format
+	string errors.
+
 2018-08-06  Pedro Franco de Carvalho  <pedromfc@linux.ibm.com>
 
 	* tracefile.c: Include common/byte-vector.h.
diff --git a/gdb/remote.c b/gdb/remote.c
index 4974c2e..33f6cd5 100644
--- a/gdb/remote.c
+++ b/gdb/remote.c
@@ -12859,7 +12859,7 @@ remote_target::download_tracepoint (struct bp_location *loc)
 		  t->step_count, t->pass_count);
 
   if (ret < 0 || ret >= buf.size ())
-    error (err_msg);
+    error ("%s", err_msg);
 
   /* Fast tracepoints are mostly handled by the target, but we can
      tell the target how big of an instruction block should be moved
@@ -12879,7 +12879,7 @@ remote_target::download_tracepoint (struct bp_location *loc)
 			      gdb_insn_length (loc->gdbarch, tpaddr));
 
 	      if (ret < 0 || ret >= size_left)
-		error (err_msg);
+		error ("%s", err_msg);
 	    }
 	  else
 	    /* If it passed validation at definition but fails now,
@@ -12910,7 +12910,7 @@ remote_target::download_tracepoint (struct bp_location *loc)
 			      size_left, ":S");
 
 	      if (ret < 0 || ret >= size_left)
-		error (err_msg);
+		error ("%s", err_msg);
 	    }
 	  else
 	    error (_("Static tracepoint not valid during download"));
@@ -12938,14 +12938,14 @@ remote_target::download_tracepoint (struct bp_location *loc)
 			  size_left, ":X%x,", aexpr->len);
 
 	  if (ret < 0 || ret >= size_left)
-	    error (err_msg);
+	    error ("%s", err_msg);
 
 	  size_left = buf.size () - strlen (buf.data ());
 
 	  /* Two bytes to encode each aexpr byte, plus the terminating
 	     null byte.  */
 	  if (aexpr->len * 2 + 1 > size_left)
-	    error (err_msg);
+	    error ("%s", err_msg);
 
 	  pkt = buf.data () + strlen (buf.data ());
 
@@ -12966,7 +12966,7 @@ remote_target::download_tracepoint (struct bp_location *loc)
 		      size_left, "-");
 
       if (ret < 0 || ret >= size_left)
-	error (err_msg);
+	error ("%s", err_msg);
     }
 
   putpkt (buf.data ());
@@ -12989,7 +12989,7 @@ remote_target::download_tracepoint (struct bp_location *loc)
 		      has_more ? '-' : 0);
 
       if (ret < 0 || ret >= buf.size ())
-	error (err_msg);
+	error ("%s", err_msg);
 
       putpkt (buf.data ());
       remote_get_noisy_reply ();
@@ -13012,7 +13012,7 @@ remote_target::download_tracepoint (struct bp_location *loc)
 		      has_more ? "-" : "");
 
       if (ret < 0 || ret >= buf.size ())
-	error (err_msg);
+	error ("%s", err_msg);
 
       putpkt (buf.data ());
       remote_get_noisy_reply ();
@@ -13027,7 +13027,7 @@ remote_target::download_tracepoint (struct bp_location *loc)
 	  ret = snprintf (buf.data (), buf.size (), "QTDPsrc:");
 
 	  if (ret < 0 || ret >= buf.size ())
-	    error (err_msg);
+	    error ("%s", err_msg);
 
 	  encode_source_string (b->number, loc->address, "at",
 				event_location_to_string (b->location.get ()),
@@ -13043,7 +13043,7 @@ remote_target::download_tracepoint (struct bp_location *loc)
 	  ret = snprintf (buf.data (), buf.size (), "QTDPsrc:");
 
 	  if (ret < 0 || ret >= buf.size ())
-	    error (err_msg);
+	    error ("%s", err_msg);
 
 	  encode_source_string (b->number, loc->address,
 				"cond", b->cond_string,
-- 
2.7.4

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

* Re: [pushed] Fix compilation failure in remote.c
  2018-08-06 20:59 [pushed] Fix compilation failure in remote.c Simon Marchi
@ 2018-08-06 21:04 ` Pedro Franco de Carvalho
  2018-08-06 21:11   ` Simon Marchi
  0 siblings, 1 reply; 3+ messages in thread
From: Pedro Franco de Carvalho @ 2018-08-06 21:04 UTC (permalink / raw)
  To: Simon Marchi, gdb-patches; +Cc: Simon Marchi

Simon Marchi <simon.marchi@ericsson.com> writes:

> A recent patch introduced a few of these:
>
> /home/emaisin/src/binutils-gdb/gdb/remote.c:12862:19: error: format not a string literal and no format arguments [-Werror=format-security]
>      error (err_msg);

Sorry! Thanks for fixing this. I must have been using a compiler version
that didn't check this.

--
Pedro Franco de Carvalho

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

* Re: [pushed] Fix compilation failure in remote.c
  2018-08-06 21:04 ` Pedro Franco de Carvalho
@ 2018-08-06 21:11   ` Simon Marchi
  0 siblings, 0 replies; 3+ messages in thread
From: Simon Marchi @ 2018-08-06 21:11 UTC (permalink / raw)
  To: Pedro Franco de Carvalho; +Cc: Simon Marchi, gdb-patches

On 2018-08-06 17:04, Pedro Franco de Carvalho wrote:
> Simon Marchi <simon.marchi@ericsson.com> writes:
> 
>> A recent patch introduced a few of these:
>> 
>> /home/emaisin/src/binutils-gdb/gdb/remote.c:12862:19: error: format 
>> not a string literal and no format arguments [-Werror=format-security]
>>      error (err_msg);
> 
> Sorry! Thanks for fixing this. I must have been using a compiler 
> version
> that didn't check this.

No problem.  The buildbot would have noticed you anyway (or will soon).

Simon

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

end of thread, other threads:[~2018-08-06 21:11 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-08-06 20:59 [pushed] Fix compilation failure in remote.c Simon Marchi
2018-08-06 21:04 ` Pedro Franco de Carvalho
2018-08-06 21:11   ` Simon Marchi

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 read-only IMAP folder(s) and NNTP newsgroup(s).