patch-2.4.10 linux/drivers/char/random.c

Next file: linux/drivers/char/raw.c
Previous file: linux/drivers/char/qtronix.c
Back to the patch index
Back to the overall index

diff -u --recursive --new-file v2.4.9/linux/drivers/char/random.c linux/drivers/char/random.c
@@ -717,6 +717,10 @@
 	} else {
 		time = jiffies;
 	}
+#elif defined (__x86_64__)
+	__u32 high;
+	rdtsc(time, high);
+	num ^= high;
 #else
 	time = jiffies;
 #endif
@@ -1587,12 +1591,9 @@
 			return -EPERM;
 		p = (int *) arg;
 		ent_count = random_state->entropy_count;
-		if (put_user(ent_count, p++))
-			return -EFAULT;
-			
-		if (get_user(size, p))
-			return -EFAULT;
-		if (put_user(random_state->poolinfo.poolwords, p++))
+		if (put_user(ent_count, p++) ||
+		    get_user(size, p) ||
+		    put_user(random_state->poolinfo.poolwords, p++))
 			return -EFAULT;
 		if (size < 0)
 			return -EINVAL;
@@ -1805,13 +1806,13 @@
 	if (uuid[8] == 0)
 		generate_random_uuid(uuid);
 
-	get_user(len, oldlenp);
+	if (get_user(len, oldlenp))
+		return -EFAULT;
 	if (len) {
 		if (len > 16)
 			len = 16;
-		if (copy_to_user(oldval, uuid, len))
-			return -EFAULT;
-		if (put_user(len, oldlenp))
+		if (copy_to_user(oldval, uuid, len) ||
+		    put_user(len, oldlenp))
 			return -EFAULT;
 	}
 	return 1;

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