From: John Baldwin <jhb@FreeBSD.org>
To: gdb-patches@sourceware.org
Subject: [PATCH] Avoid harmful fall throughs in core_target::xfer_partial.
Date: Wed, 16 Mar 2022 12:36:04 -0700 [thread overview]
Message-ID: <20220316193604.89477-1-jhb@FreeBSD.org> (raw)
The cases for TARGET_OBJECT_LIBRARIES and TARGET_OBJECT_LIBRARIES_AIX
can try to fetch different data objects (such as
TARGET_OBJECT_SIGNAL_INFO) if gdbarch methods for the requested data
aren't present. Replace case fallthroughs with an explicit goto to
the default case.
---
gdb/corelow.c | 5 +++--
1 file changed, 3 insertions(+), 2 deletions(-)
diff --git a/gdb/corelow.c b/gdb/corelow.c
index 1579e6bc2b8..f7f2bd3f318 100644
--- a/gdb/corelow.c
+++ b/gdb/corelow.c
@@ -943,7 +943,7 @@ core_target::xfer_partial (enum target_object object, const char *annex,
return TARGET_XFER_OK;
}
}
- /* FALL THROUGH */
+ goto fallthrough;
case TARGET_OBJECT_LIBRARIES_AIX:
if (m_core_gdbarch != nullptr
@@ -964,7 +964,7 @@ core_target::xfer_partial (enum target_object object, const char *annex,
return TARGET_XFER_OK;
}
}
- /* FALL THROUGH */
+ goto fallthrough;
case TARGET_OBJECT_SIGNAL_INFO:
if (readbuf)
@@ -988,6 +988,7 @@ core_target::xfer_partial (enum target_object object, const char *annex,
return TARGET_XFER_E_IO;
default:
+ fallthrough:
return this->beneath ()->xfer_partial (object, annex, readbuf,
writebuf, offset, len,
xfered_len);
--
2.34.1
next reply other threads:[~2022-03-16 19:36 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-03-16 19:36 John Baldwin [this message]
2022-03-17 16:06 ` Pedro Alves
2022-03-17 16:23 ` John Baldwin
2022-03-17 16:26 ` Pedro Alves
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=20220316193604.89477-1-jhb@FreeBSD.org \
--to=jhb@freebsd.org \
--cc=gdb-patches@sourceware.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 read-only IMAP folder(s) and NNTP newsgroup(s).