* [Qemu-devel] [PATCH 1/1] migration: mmap error check fix
@ 2016-07-29 9:48 Denis V. Lunev
2016-07-29 10:42 ` Amit Shah
2016-07-29 10:43 ` Dr. David Alan Gilbert
0 siblings, 2 replies; 3+ messages in thread
From: Denis V. Lunev @ 2016-07-29 9:48 UTC (permalink / raw)
To: qemu-devel; +Cc: den, Evgeny Yakovlev, Juan Quintela, Amit Shah
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>
CC: Juan Quintela <quintela@redhat.com>
CC: Amit Shah <amit.shah@redhat.com>
---
migration/postcopy-ram.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/migration/postcopy-ram.c b/migration/postcopy-ram.c
index abe8c60..e761f3c 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
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [Qemu-devel] [PATCH 1/1] migration: mmap error check fix
2016-07-29 9:48 [Qemu-devel] [PATCH 1/1] migration: mmap error check fix Denis V. Lunev
@ 2016-07-29 10:42 ` Amit Shah
2016-07-29 10:43 ` Dr. David Alan Gilbert
1 sibling, 0 replies; 3+ messages in thread
From: Amit Shah @ 2016-07-29 10:42 UTC (permalink / raw)
To: Denis V. Lunev; +Cc: qemu-devel, Evgeny Yakovlev, Juan Quintela
On (Fri) 29 Jul 2016 [12:48:25], Denis V. Lunev wrote:
> 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>
> CC: Juan Quintela <quintela@redhat.com>
> CC: Amit Shah <amit.shah@redhat.com>
Reviewed-by: Amit Shah <amit.shah@redhat.com>
Amit
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [Qemu-devel] [PATCH 1/1] migration: mmap error check fix
2016-07-29 9:48 [Qemu-devel] [PATCH 1/1] migration: mmap error check fix Denis V. Lunev
2016-07-29 10:42 ` Amit Shah
@ 2016-07-29 10:43 ` Dr. David Alan Gilbert
1 sibling, 0 replies; 3+ messages in thread
From: Dr. David Alan Gilbert @ 2016-07-29 10:43 UTC (permalink / raw)
To: Denis V. Lunev; +Cc: qemu-devel, Amit Shah, Evgeny Yakovlev, Juan Quintela
* Denis V. Lunev (den@openvz.org) wrote:
> 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.
Oops, nice spot!
Reviewed-by: Dr. David Alan Gilbert <dgilbert@redhat.com>
> Signed-off-by: Evgeny Yakovlev <eyakovlev@virtuozzo.com>
> Signed-off-by: Denis V. Lunev <den@openvz.org>
> CC: Juan Quintela <quintela@redhat.com>
> CC: Amit Shah <amit.shah@redhat.com>
> ---
> migration/postcopy-ram.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/migration/postcopy-ram.c b/migration/postcopy-ram.c
> index abe8c60..e761f3c 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
>
>
--
Dr. David Alan Gilbert / dgilbert@redhat.com / Manchester, UK
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2016-07-29 10:43 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-07-29 9:48 [Qemu-devel] [PATCH 1/1] migration: mmap error check fix Denis V. Lunev
2016-07-29 10:42 ` Amit Shah
2016-07-29 10:43 ` Dr. David Alan Gilbert
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).