From: Amit Shah <amit.shah@redhat.com>
To: Peter Maydell <peter.maydell@linaro.org>
Cc: qemu list <qemu-devel@nongnu.org>,
caoj.fnst@cn.fujitsu.com, eyakovlev@virtuozzo.com,
den@openvz.org, liang.z.li@intel.com,
"Dr. David Alan Gilbert" <dgilbert@redhat.com>,
Juan Quintela <quintela@redhat.com>,
Amit Shah <amit.shah@redhat.com>
Subject: [Qemu-devel] [PULL 2.7 2/4] migration: mmap error check fix
Date: Thu, 11 Aug 2016 17:09:40 +0530 [thread overview]
Message-ID: <0e8b3cdfbc167f4bb7790ef744eaa1ac0e6959f9.1470915381.git.amit.shah@redhat.com> (raw)
In-Reply-To: <cover.1470915381.git.amit.shah@redhat.com>
In-Reply-To: <cover.1470915381.git.amit.shah@redhat.com>
From: Evgeny Yakovlev <eyakovlev@virtuozzo.com>
mmap man page:
"On success, mmap() returns a pointer to the mapped area. On error, the
value MAP_FAILED (that is, (void *) -1) is returned, and errno is set
to indicate the cause of the error."
The check in postcopy_get_tmp_page is definitely wrong and should be
fixed.
Signed-off-by: Evgeny Yakovlev <eyakovlev@virtuozzo.com>
Signed-off-by: Denis V. Lunev <den@openvz.org>
Reviewed-by: Amit Shah <amit.shah@redhat.com>
Reviewed-by: Dr. David Alan Gilbert <dgilbert@redhat.com>
CC: Juan Quintela <quintela@redhat.com>
CC: Amit Shah <amit.shah@redhat.com>
Message-Id: <1469785705-16670-1-git-send-email-den@openvz.org>
Signed-off-by: Amit Shah <amit.shah@redhat.com>
---
migration/postcopy-ram.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/migration/postcopy-ram.c b/migration/postcopy-ram.c
index abe8c60..9b04778 100644
--- a/migration/postcopy-ram.c
+++ b/migration/postcopy-ram.c
@@ -604,7 +604,8 @@ void *postcopy_get_tmp_page(MigrationIncomingState *mis)
mis->postcopy_tmp_page = mmap(NULL, getpagesize(),
PROT_READ | PROT_WRITE, MAP_PRIVATE |
MAP_ANONYMOUS, -1, 0);
- if (!mis->postcopy_tmp_page) {
+ if (mis->postcopy_tmp_page == MAP_FAILED) {
+ mis->postcopy_tmp_page = NULL;
error_report("%s: %s", __func__, strerror(errno));
return NULL;
}
--
2.7.4
next prev parent reply other threads:[~2016-08-11 11:40 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-08-11 11:39 [Qemu-devel] [PULL 2.7 0/4] migration: fixes Amit Shah
2016-08-11 11:39 ` [Qemu-devel] [PULL 2.7 1/4] migration/ram: fix typo Amit Shah
2016-08-11 11:39 ` Amit Shah [this message]
2016-08-11 11:39 ` [Qemu-devel] [PULL 2.7 3/4] migration: fix live migration failure with compression Amit Shah
2016-08-11 11:39 ` [Qemu-devel] [PULL 2.7 4/4] migration/socket: fix typo in file header Amit Shah
2016-08-11 17:54 ` [Qemu-devel] [PULL 2.7 0/4] migration: fixes Peter Maydell
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=0e8b3cdfbc167f4bb7790ef744eaa1ac0e6959f9.1470915381.git.amit.shah@redhat.com \
--to=amit.shah@redhat.com \
--cc=caoj.fnst@cn.fujitsu.com \
--cc=den@openvz.org \
--cc=dgilbert@redhat.com \
--cc=eyakovlev@virtuozzo.com \
--cc=liang.z.li@intel.com \
--cc=peter.maydell@linaro.org \
--cc=qemu-devel@nongnu.org \
--cc=quintela@redhat.com \
/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).