All of lore.kernel.org
 help / color / mirror / Atom feed
* [patch] add copy_to_user result check
@ 2005-07-17  9:02 Coywolf Qi Hunt
  0 siblings, 0 replies; only message in thread
From: Coywolf Qi Hunt @ 2005-07-17  9:02 UTC (permalink / raw)
  To: akpm; +Cc: linux-kernel

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)

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2005-07-17  9:02 UTC | newest]

Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2005-07-17  9:02 [patch] add copy_to_user result check Coywolf Qi Hunt

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.