lkml.org 
[lkml]   [2005]   [Jul]   [17]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
From
Date
Subject[patch] add copy_to_user result check
hello,

GCC warns me this problem. This patch adds copy_to_user result check
in sys_select() and sys_pselect7().


Signed-off-by: Coywolf Qi Hunt <coywolf@lovecn.org>
---
diff -pruN 2.6.13-rc3-mm1/fs/select.c 2.6.13-rc3-mm1-cy1/fs/select.c
--- 2.6.13-rc3-mm1/fs/select.c 2005-07-15 23:51:35.000000000 +0800
+++ 2.6.13-rc3-mm1-cy1/fs/select.c 2005-07-17 16:26:58.000000000 +0800
@@ -401,7 +401,8 @@ asmlinkage long sys_select(int n, fd_set
tv.tv_sec++;
tv.tv_usec -= 1000000;
}
- copy_to_user(tvp, &tv, sizeof(tv));
+ if (copy_to_user(tvp, &tv, sizeof(tv)))
+ return -EFAULT;
}

return ret;
@@ -459,7 +460,8 @@ asmlinkage long sys_pselect7(int n, fd_s
ts.tv_sec++;
ts.tv_nsec -= 1000000000;
}
- copy_to_user(tsp, &ts, sizeof(ts));
+ if (copy_to_user(tsp, &ts, sizeof(ts)))
+ return -EFAULT;
}

if (sigmask)
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
\
 
 \ /
  Last update: 2005-07-17 11:06    [W:0.015 / U:0.036 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site