qemu-devel
[Top][All Lists]
Advanced

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

[Qemu-devel] [PULL 09/17] linux-user: check fd is >= 0 in fd_trans_host_


From: riku . voipio
Subject: [Qemu-devel] [PULL 09/17] linux-user: check fd is >= 0 in fd_trans_host_to_target_data/fd_trans_host_to_target_addr
Date: Mon, 11 Jan 2016 16:16:11 +0200

From: Laurent Vivier <address@hidden>

Signed-off-by: Laurent Vivier <address@hidden>
Signed-off-by: Riku Voipio <address@hidden>
---
 linux-user/syscall.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/linux-user/syscall.c b/linux-user/syscall.c
index 94d64fa..ff20ea7 100644
--- a/linux-user/syscall.c
+++ b/linux-user/syscall.c
@@ -309,7 +309,7 @@ static unsigned int target_fd_max;
 
 static TargetFdDataFunc fd_trans_host_to_target_data(int fd)
 {
-    if (fd < target_fd_max && target_fd_trans[fd]) {
+    if (fd >= 0 && fd < target_fd_max && target_fd_trans[fd]) {
         return target_fd_trans[fd]->host_to_target_data;
     }
     return NULL;
@@ -317,7 +317,7 @@ static TargetFdDataFunc fd_trans_host_to_target_data(int fd)
 
 static TargetFdAddrFunc fd_trans_target_to_host_addr(int fd)
 {
-    if (fd < target_fd_max && target_fd_trans[fd]) {
+    if (fd >= 0 && fd < target_fd_max && target_fd_trans[fd]) {
         return target_fd_trans[fd]->target_to_host_addr;
     }
     return NULL;
-- 
2.6.4




reply via email to

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