diff options
author | Peter Maydell | 2020-11-06 00:46:19 +0100 |
---|---|---|
committer | Peter Maydell | 2020-11-06 00:46:19 +0100 |
commit | 42705e269186fb309dd9120f540e2cab05422cb9 (patch) | |
tree | 79f6d4176a35affa160e6a597ccc89d28a603f44 | |
parent | Merge remote-tracking branch 'remotes/dg-gitlab/tags/ppc-for-5.2-20201105' in... (diff) | |
parent | linux-user: Check copy_from_user() return value in vma_dump_size() (diff) | |
download | qemu-42705e269186fb309dd9120f540e2cab05422cb9.tar.gz qemu-42705e269186fb309dd9120f540e2cab05422cb9.tar.xz qemu-42705e269186fb309dd9120f540e2cab05422cb9.zip |
Merge remote-tracking branch 'remotes/vivier2/tags/linux-user-for-5.2-pull-request' into staging
Coverity and compiler warning fixes
# gpg: Signature made Thu 05 Nov 2020 07:07:56 GMT
# gpg: using RSA key CD2F75DDC8E3A4DC2E4F5173F30C38BD3F2FBE3C
# gpg: issuer "laurent@vivier.eu"
# gpg: Good signature from "Laurent Vivier <lvivier@redhat.com>" [full]
# gpg: aka "Laurent Vivier <laurent@vivier.eu>" [full]
# gpg: aka "Laurent Vivier (Red Hat) <lvivier@redhat.com>" [full]
# Primary key fingerprint: CD2F 75DD C8E3 A4DC 2E4F 5173 F30C 38BD 3F2F BE3C
* remotes/vivier2/tags/linux-user-for-5.2-pull-request:
linux-user: Check copy_from_user() return value in vma_dump_size()
linux-user/syscall: Fix missing target_to_host_timespec64() check
linux-user: Use "!= 0" when checking if MAP_FIXED_NOREPLACE is non-zero
linux-user/mips/cpu_loop: silence the compiler warnings
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
-rw-r--r-- | linux-user/elfload.c | 7 | ||||
-rw-r--r-- | linux-user/mips/cpu_loop.c | 4 | ||||
-rw-r--r-- | linux-user/syscall.c | 4 |
3 files changed, 12 insertions, 3 deletions
diff --git a/linux-user/elfload.c b/linux-user/elfload.c index bf8c1bd253..0b02a92602 100644 --- a/linux-user/elfload.c +++ b/linux-user/elfload.c @@ -2188,7 +2188,8 @@ static uintptr_t pgd_find_hole_fallback(uintptr_t guest_size, uintptr_t brk, PROT_NONE, flags, -1, 0); if (mmap_start != MAP_FAILED) { munmap((void *) align_start, guest_size); - if (MAP_FIXED_NOREPLACE || mmap_start == (void *) align_start) { + if (MAP_FIXED_NOREPLACE != 0 || + mmap_start == (void *) align_start) { return (uintptr_t) mmap_start + offset; } } @@ -3484,7 +3485,9 @@ static abi_ulong vma_dump_size(const struct vm_area_struct *vma) if (vma->vma_flags & PROT_EXEC) { char page[TARGET_PAGE_SIZE]; - copy_from_user(page, vma->vma_start, sizeof (page)); + if (copy_from_user(page, vma->vma_start, sizeof (page))) { + return 0; + } if ((page[EI_MAG0] == ELFMAG0) && (page[EI_MAG1] == ELFMAG1) && (page[EI_MAG2] == ELFMAG2) && diff --git a/linux-user/mips/cpu_loop.c b/linux-user/mips/cpu_loop.c index 553e8ca7f5..cfe7ba5c47 100644 --- a/linux-user/mips/cpu_loop.c +++ b/linux-user/mips/cpu_loop.c @@ -104,18 +104,22 @@ void cpu_loop(CPUMIPSState *env) if ((ret = get_user_ual(arg8, sp_reg + 28)) != 0) { goto done_syscall; } + /* fall through */ case 7: if ((ret = get_user_ual(arg7, sp_reg + 24)) != 0) { goto done_syscall; } + /* fall through */ case 6: if ((ret = get_user_ual(arg6, sp_reg + 20)) != 0) { goto done_syscall; } + /* fall through */ case 5: if ((ret = get_user_ual(arg5, sp_reg + 16)) != 0) { goto done_syscall; } + /* fall through */ default: break; } diff --git a/linux-user/syscall.c b/linux-user/syscall.c index 6fef8181e7..3160a9ba06 100644 --- a/linux-user/syscall.c +++ b/linux-user/syscall.c @@ -7592,7 +7592,9 @@ static int do_futex_time64(target_ulong uaddr, int op, int val, target_ulong tim case FUTEX_WAIT_BITSET: if (timeout) { pts = &ts; - target_to_host_timespec64(pts, timeout); + if (target_to_host_timespec64(pts, timeout)) { + return -TARGET_EFAULT; + } } else { pts = NULL; } |