patch-2.2.12 linux/include/linux/poll.h

Next file: linux/include/linux/proc_fs.h
Previous file: linux/include/linux/pci.h
Back to the patch index
Back to the overall index

diff -u --recursive --new-file v2.2.11/linux/include/linux/poll.h linux/include/linux/poll.h
@@ -59,9 +59,6 @@
 	unsigned long *res_in, *res_out, *res_ex;
 } fd_set_bits;
 
-/*
- * How many longwords for "nr" bits?
- */
 #define FDS_BITPERLONG	(8*sizeof(long))
 #define FDS_LONGS(nr)	(((nr)+FDS_BITPERLONG-1)/FDS_BITPERLONG)
 #define FDS_BYTES(nr)	(FDS_LONGS(nr)*sizeof(long))
@@ -90,14 +87,17 @@
 static inline
 void set_fd_set(unsigned long nr, void *ufdset, unsigned long *fdset)
 {
-	if (ufdset)
-		__copy_to_user(ufdset, fdset, FDS_BYTES(nr));
+	if (ufdset) {
+		nr = FDS_BYTES(nr);
+		__copy_to_user(ufdset, fdset, nr);
+	}
 }
 
 static inline
 void zero_fd_set(unsigned long nr, unsigned long *fdset)
 {
-	memset(fdset, 0, FDS_BYTES(nr));
+	nr = FDS_BYTES(nr);
+	memset(fdset, 0, nr);
 }
 
 extern int do_select(int n, fd_set_bits *fds, long *timeout);

FUNET's LINUX-ADM group, linux-adm@nic.funet.fi
TCL-scripts by Sam Shen (who was at: slshen@lbl.gov)