[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [PATCH 09/10] linux-user: fix utimensat with NULL timespec
From: |
riku . voipio |
Subject: |
[Qemu-devel] [PATCH 09/10] linux-user: fix utimensat with NULL timespec |
Date: |
Wed, 29 Apr 2009 21:03:22 +0300 |
From: Riku Voipio <address@hidden>
don't try to copy timespec from user if is NULL.
Signed-off-by: Riku Voipio <address@hidden>
---
linux-user/syscall.c | 15 ++++++++++-----
1 files changed, 10 insertions(+), 5 deletions(-)
diff --git a/linux-user/syscall.c b/linux-user/syscall.c
index f99db77..be00c7e 100644
--- a/linux-user/syscall.c
+++ b/linux-user/syscall.c
@@ -6674,17 +6674,22 @@ abi_long do_syscall(void *cpu_env, int num, abi_long
arg1,
#if defined(TARGET_NR_utimensat) && defined(__NR_utimensat)
case TARGET_NR_utimensat:
{
- struct timespec ts[2];
- target_to_host_timespec(ts, arg3);
- target_to_host_timespec(ts+1, arg3+sizeof(struct target_timespec));
+ struct timespec *tsp, ts[2];
+ if (!arg3) {
+ tsp = NULL;
+ } else {
+ target_to_host_timespec(ts, arg3);
+ target_to_host_timespec(ts+1, arg3+sizeof(struct
target_timespec));
+ tsp = ts;
+ }
if (!arg2)
- ret = get_errno(sys_utimensat(arg1, NULL, ts, arg4));
+ ret = get_errno(sys_utimensat(arg1, NULL, tsp, arg4));
else {
if (!(p = lock_user_string(arg2))) {
ret = -TARGET_EFAULT;
goto fail;
}
- ret = get_errno(sys_utimensat(arg1, path(p), ts, arg4));
+ ret = get_errno(sys_utimensat(arg1, path(p), tsp, arg4));
unlock_user(p, arg2, 0);
}
}
--
1.6.2.1
- [Qemu-devel] [PATCH 01/10] export mmap_find_vma for shmat, riku . voipio, 2009/04/29
- [Qemu-devel] [PATCH 02/10] Implement shm* syscalls and fix 64/32bit errors, riku . voipio, 2009/04/29
- [Qemu-devel] [PATCH 04/10] linux-user: added x86 and x86_64 support for ELF coredump, riku . voipio, 2009/04/29
- [Qemu-devel] [PATCH 06/10] Revived GUEST_BASE support for usermode emulation targets [v2], riku . voipio, 2009/04/29
- [Qemu-devel] [PATCH 05/10] linux-user: strace now handles guest strings correctly, riku . voipio, 2009/04/29
- [Qemu-devel] [PATCH 10/10] Return EOPNOTSUPP instead of ENOSYS for *xattr* syscalls, riku . voipio, 2009/04/29
- [Qemu-devel] [PATCH 03/10] linux-user: implemented ELF coredump support for ARM target [v2], riku . voipio, 2009/04/29
- [Qemu-devel] [PATCH 08/10] Fix struct termios host - target translation, riku . voipio, 2009/04/29
- [Qemu-devel] [PATCH 09/10] linux-user: fix utimensat with NULL timespec,
riku . voipio <=
- [Qemu-devel] [PATCH 07/10] linux-user: fix utimensat when used as futimens, riku . voipio, 2009/04/29
- Re: [Qemu-devel] [PATCH 01/10] export mmap_find_vma for shmat, Martin Mohring, 2009/04/30