From: Markus Armbruster <armbru@redhat.com>
To: qemu-devel@nongnu.org
Cc: Yury Kotov <yury-kotov@yandex-team.ru>
Subject: [Qemu-devel] [PULL 01/16] monitor: Fix return type of monitor_fdset_dup_fd_find
Date: Mon, 17 Jun 2019 20:48:48 +0200 [thread overview]
Message-ID: <20190617184903.19436-2-armbru@redhat.com> (raw)
In-Reply-To: <20190617184903.19436-1-armbru@redhat.com>
From: Yury Kotov <yury-kotov@yandex-team.ru>
monitor_fdset_dup_fd_find_remove() and monitor_fdset_dup_fd_find()
return mon_fdset->id which is int64_t. Downcasting from int64_t to int
leads to a bug with removing fd from fdset with id >= 2^32.
So, fix return types for these function.
Signed-off-by: Yury Kotov <yury-kotov@yandex-team.ru>
Reviewed-by: Markus Armbruster <armbru@redhat.com>
Message-Id: <20190523094433.30297-1-yury-kotov@yandex-team.ru>
Signed-off-by: Markus Armbruster <armbru@redhat.com>
---
include/monitor/monitor.h | 2 +-
monitor.c | 4 ++--
stubs/fdset.c | 2 +-
3 files changed, 4 insertions(+), 4 deletions(-)
diff --git a/include/monitor/monitor.h b/include/monitor/monitor.h
index 06cfcd8f36..1e1d6d2269 100644
--- a/include/monitor/monitor.h
+++ b/include/monitor/monitor.h
@@ -44,6 +44,6 @@ AddfdInfo *monitor_fdset_add_fd(int fd, bool has_fdset_id, int64_t fdset_id,
int monitor_fdset_get_fd(int64_t fdset_id, int flags);
int monitor_fdset_dup_fd_add(int64_t fdset_id, int dup_fd);
void monitor_fdset_dup_fd_remove(int dup_fd);
-int monitor_fdset_dup_fd_find(int dup_fd);
+int64_t monitor_fdset_dup_fd_find(int dup_fd);
#endif /* MONITOR_H */
diff --git a/monitor.c b/monitor.c
index 5c5cbe254a..dce3496920 100644
--- a/monitor.c
+++ b/monitor.c
@@ -2604,7 +2604,7 @@ err:
return -1;
}
-static int monitor_fdset_dup_fd_find_remove(int dup_fd, bool remove)
+static int64_t monitor_fdset_dup_fd_find_remove(int dup_fd, bool remove)
{
MonFdset *mon_fdset;
MonFdsetFd *mon_fdset_fd_dup;
@@ -2632,7 +2632,7 @@ err:
return -1;
}
-int monitor_fdset_dup_fd_find(int dup_fd)
+int64_t monitor_fdset_dup_fd_find(int dup_fd)
{
return monitor_fdset_dup_fd_find_remove(dup_fd, false);
}
diff --git a/stubs/fdset.c b/stubs/fdset.c
index f3d9980b7e..67dd5e1d34 100644
--- a/stubs/fdset.c
+++ b/stubs/fdset.c
@@ -6,7 +6,7 @@ int monitor_fdset_dup_fd_add(int64_t fdset_id, int dup_fd)
return -1;
}
-int monitor_fdset_dup_fd_find(int dup_fd)
+int64_t monitor_fdset_dup_fd_find(int dup_fd)
{
return -1;
}
--
2.21.0
next prev parent reply other threads:[~2019-06-17 19:10 UTC|newest]
Thread overview: 26+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-06-17 18:48 [Qemu-devel] [PULL 00/16] Monitor patches for 2019-06-17 Markus Armbruster
2019-06-17 18:48 ` Markus Armbruster [this message]
2019-06-17 18:48 ` [Qemu-devel] [PULL 02/16] monitor: Remove unused password prompting fields Markus Armbruster
2019-06-17 18:48 ` [Qemu-devel] [PULL 03/16] monitor: Split monitor_init in HMP and QMP function Markus Armbruster
2019-06-17 18:48 ` [Qemu-devel] [PULL 04/16] monitor: Make MonitorQMP a child class of Monitor Markus Armbruster
2019-06-17 18:48 ` [Qemu-devel] [PULL 05/16] monitor: Create MonitorHMP with readline state Markus Armbruster
2019-06-17 18:48 ` [Qemu-devel] [PULL 06/16] monitor: Remove Monitor.cmd_table indirection Markus Armbruster
2019-06-17 18:48 ` [Qemu-devel] [PULL 07/16] monitor: Rename HMP command type and tables Markus Armbruster
2019-06-17 18:48 ` [Qemu-devel] [PULL 08/16] Move monitor.c to monitor/misc.c Markus Armbruster
2019-06-17 18:48 ` [Qemu-devel] [PULL 09/16] monitor: Move {hmp, qmp}.c to monitor/{hmp, qmp}-cmds.c Markus Armbruster
2019-06-17 18:48 ` [Qemu-devel] [PULL 10/16] monitor: Create monitor-internal.h with common definitions Markus Armbruster
2019-06-17 18:48 ` [Qemu-devel] [PULL 11/16] monitor: Split out monitor/qmp.c Markus Armbruster
2019-06-17 18:48 ` [Qemu-devel] [PULL 12/16] monitor: Split out monitor/hmp.c Markus Armbruster
2019-06-17 18:49 ` [Qemu-devel] [PULL 13/16] monitor: Split out monitor/monitor.c Markus Armbruster
2019-06-17 18:49 ` [Qemu-devel] [PULL 14/16] monitor: Split Monitor.flags into separate bools Markus Armbruster
2019-06-17 18:49 ` [Qemu-devel] [PULL 15/16] monitor: Replace monitor_init() with monitor_init_{hmp, qmp}() Markus Armbruster
2019-06-17 18:49 ` [Qemu-devel] [PULL 16/16] vl: Deprecate -mon pretty=... for HMP monitors Markus Armbruster
2019-06-18 9:01 ` Daniel P. Berrangé
2019-06-18 10:34 ` Kevin Wolf
2019-06-19 6:42 ` Markus Armbruster
2019-06-19 9:18 ` Kevin Wolf
2019-06-19 9:20 ` Daniel P. Berrangé
2019-06-17 18:58 ` [Qemu-devel] [PULL 00/16] Monitor patches for 2019-06-17 Peter Maydell
2019-06-18 6:07 ` Markus Armbruster
2019-06-17 20:04 ` no-reply
2019-06-17 22:49 ` no-reply
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=20190617184903.19436-2-armbru@redhat.com \
--to=armbru@redhat.com \
--cc=qemu-devel@nongnu.org \
--cc=yury-kotov@yandex-team.ru \
/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).