qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Qemu-devel] [PATCH 1/1] migration: mmap error check fix


From: Dr. David Alan Gilbert
Subject: Re: [Qemu-devel] [PATCH 1/1] migration: mmap error check fix
Date: Fri, 29 Jul 2016 11:43:06 +0100
User-agent: Mutt/1.6.2 (2016-07-01)

* Denis V. Lunev (address@hidden) wrote:
> From: Evgeny Yakovlev <address@hidden>
> 
> 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 <address@hidden>

> Signed-off-by: Evgeny Yakovlev <address@hidden>
> Signed-off-by: Denis V. Lunev <address@hidden>
> CC: Juan Quintela <address@hidden>
> CC: Amit Shah <address@hidden>
> ---
>  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 / address@hidden / Manchester, UK



reply via email to

[Prev in Thread] Current Thread [Next in Thread]