diff options
| author | Michael S. Tsirkin | 2015-10-25 16:07:45 +0100 |
|---|---|---|
| committer | Michael S. Tsirkin | 2015-10-29 10:05:24 +0100 |
| commit | 9d4ec9370a36f8a564e1ba05519328c0bd60da13 (patch) | |
| tree | 0f306574ea8fb2d77fecf35f4f862e03dfdd5a0a /util | |
| parent | pc: memhp: do not emit inserting event for coldplugged DIMMs (diff) | |
| download | qemu-9d4ec9370a36f8a564e1ba05519328c0bd60da13.tar.gz qemu-9d4ec9370a36f8a564e1ba05519328c0bd60da13.tar.xz qemu-9d4ec9370a36f8a564e1ba05519328c0bd60da13.zip | |
mmap-alloc: fix error handling
Existing callers are checking for MAP_FAILED,
so we should return that on error.
Reported-by: Paolo Bonzini <pbonzini@redhat.com>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
Diffstat (limited to 'util')
| -rw-r--r-- | util/mmap-alloc.c | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/util/mmap-alloc.c b/util/mmap-alloc.c index 13942694cc..c37acbe58e 100644 --- a/util/mmap-alloc.c +++ b/util/mmap-alloc.c @@ -26,7 +26,7 @@ void *qemu_ram_mmap(int fd, size_t size, size_t align, bool shared) void *ptr1; if (ptr == MAP_FAILED) { - return NULL; + return MAP_FAILED; } /* Make sure align is a power of 2 */ @@ -41,7 +41,7 @@ void *qemu_ram_mmap(int fd, size_t size, size_t align, bool shared) fd, 0); if (ptr1 == MAP_FAILED) { munmap(ptr, total); - return NULL; + return MAP_FAILED; } ptr += offset; |
