Page Menu
Home
FreeBSD
Search
Configure Global Search
Log In
Files
F145182264
D6442.1777508767.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Flag For Later
Award Token
Size
2 KB
Referenced Files
None
Subscribers
None
D6442.1777508767.diff
View Options
Index: sys/geom/multipath/g_multipath.c
===================================================================
--- sys/geom/multipath/g_multipath.c
+++ sys/geom/multipath/g_multipath.c
@@ -898,7 +898,7 @@
sc = gp1->softc;
if (gp == NULL) {
char buf[16];
- u_long rand = random();
+ u_long rand = arc4random();
snprintf(buf, sizeof (buf), "%s-%lu", md.md_name, rand);
printf("GEOM_MULTIPATH: geom %s/%s exists already\n",
Index: sys/kern/kern_fail.c
===================================================================
--- sys/kern/kern_fail.c
+++ sys/kern/kern_fail.c
@@ -167,7 +167,7 @@
volatile bool fe_stale;
enum fail_point_t fe_type; /**< type of entry */
int fe_arg; /**< argument to type (e.g. return value) */
- int fe_prob; /**< likelihood of firing in millionths */
+ u_int fe_prob; /**< likelihood of firing in millionths */
int32_t fe_count; /**< number of times to fire, -1 means infinite */
pid_t fe_pid; /**< only fail for this process */
struct fail_point *fe_parent; /**< backpointer to fp */
@@ -568,7 +568,7 @@
continue;
if (ent->fe_prob < PROB_MAX &&
- ent->fe_prob < random() % PROB_MAX)
+ ent->fe_prob < arc4random() % PROB_MAX)
continue;
if (ent->fe_pid != NO_PID && ent->fe_pid != curproc->p_pid)
Index: sys/kern/kern_synch.c
===================================================================
--- sys/kern/kern_synch.c
+++ sys/kern/kern_synch.c
@@ -607,7 +607,7 @@
* run at regular intervals.
*/
callout_reset_sbt(&loadav_callout,
- SBT_1US * (4000000 + (int)(random() % 2000001)), SBT_1US,
+ SBT_1US * (4000000 + (arc4random() % 2000001)), SBT_1US,
loadav, NULL, C_DIRECT_EXEC | C_PREL(32));
}
Index: sys/net/altq/altq_classq.h
===================================================================
--- sys/net/altq/altq_classq.h
+++ sys/net/altq/altq_classq.h
@@ -152,7 +152,7 @@
_getq_random(class_queue_t *q)
{
struct mbuf *m;
- int i, n;
+ u_int i, n;
if ((m = qtail(q)) == NULL)
return NULL;
@@ -161,7 +161,7 @@
else {
struct mbuf *prev = NULL;
- n = random() % qlen(q) + 1;
+ n = arc4random() % qlen(q) + 1;
for (i = 0; i < n; i++) {
prev = m;
m = m->m_nextpkt;
Index: sys/vm/memguard.c
===================================================================
--- sys/vm/memguard.c
+++ sys/vm/memguard.c
@@ -447,7 +447,7 @@
if ((memguard_options & MG_GUARD_ALLLARGE) != 0 && size >= PAGE_SIZE)
return (1);
if (memguard_frequency > 0 &&
- (random() % 100000) < memguard_frequency) {
+ (arc4random() % 100000) < memguard_frequency) {
memguard_frequency_hits++;
return (1);
}
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Thu, Apr 30, 12:26 AM (3 h, 20 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
28476557
Default Alt Text
D6442.1777508767.diff (2 KB)
Attached To
Mode
D6442: Make more use of arc4random() in the kernel.
Attached
Detach File
Event Timeline
Log In to Comment