From: "Dr. David Alan Gilbert" <dgilbert@redhat.com>
To: Markus Armbruster <armbru@redhat.com>
Cc: Yury Kotov <yury-kotov@yandex-team.ru>,
Paolo Bonzini <pbonzini@redhat.com>,
qemu-devel@nongnu.org
Subject: Re: [Qemu-devel] [PATCH v3] monitor: Fix return type of monitor_fdset_dup_fd_find
Date: Fri, 31 May 2019 20:07:53 +0100 [thread overview]
Message-ID: <20190531190753.GO3169@work-vm> (raw)
In-Reply-To: <87k1ebdsbm.fsf@dusky.pond.sub.org>
* Markus Armbruster (armbru@redhat.com) wrote:
> David, got anything queued for the monitor? If yes, can you stick this
> in? If not, I can handle it.
I've not got anything else, so please take it;
am I right in thinking this supercedes
'monitor: Fix fdset_id & fd types for corresponding QMP commands'
Thanks,
Dave
> Yury Kotov <yury-kotov@yandex-team.ru> writes:
>
> > 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>
> > ---
> > 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 86656297f1..51f048d61f 100644
> > --- a/include/monitor/monitor.h
> > +++ b/include/monitor/monitor.h
> > @@ -45,6 +45,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 6428eb3b7e..a0e637f7d6 100644
> > --- a/monitor.c
> > +++ b/monitor.c
> > @@ -2602,7 +2602,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;
> > @@ -2630,7 +2630,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 4f3edf2ea4..a1b8f41f62 100644
> > --- a/stubs/fdset.c
> > +++ b/stubs/fdset.c
> > @@ -7,7 +7,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;
> > }
--
Dr. David Alan Gilbert / dgilbert@redhat.com / Manchester, UK
next prev parent reply other threads:[~2019-05-31 19:08 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-05-23 9:44 [Qemu-devel] [PATCH v3] monitor: Fix return type of monitor_fdset_dup_fd_find Yury Kotov
2019-05-27 8:09 ` Yury Kotov
2019-05-28 6:08 ` Markus Armbruster
2019-05-31 19:07 ` Dr. David Alan Gilbert [this message]
2019-06-03 8:15 ` Markus Armbruster
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=20190531190753.GO3169@work-vm \
--to=dgilbert@redhat.com \
--cc=armbru@redhat.com \
--cc=pbonzini@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).