Page MenuHomeFreeBSD

D6442.1777525296.diff
No OneTemporary

Size
2 KB
Referenced Files
None
Subscribers
None

D6442.1777525296.diff

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

Mime Type
text/plain
Expires
Thu, Apr 30, 5:01 AM (10 h, 4 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
28476557
Default Alt Text
D6442.1777525296.diff (2 KB)

Event Timeline