Changeset View
Changeset View
Standalone View
Standalone View
sys/vm/memguard.c
Show First 20 Lines • Show All 452 Lines • ▼ Show 20 Lines | memguard_cmp(unsigned long size) | ||||
if (size < memguard_minsize) { | if (size < memguard_minsize) { | ||||
memguard_minsize_reject++; | memguard_minsize_reject++; | ||||
return (0); | return (0); | ||||
} | } | ||||
if ((memguard_options & MG_GUARD_ALLLARGE) != 0 && size >= PAGE_SIZE) | if ((memguard_options & MG_GUARD_ALLLARGE) != 0 && size >= PAGE_SIZE) | ||||
return (1); | return (1); | ||||
if (memguard_frequency > 0 && | if (memguard_frequency > 0 && | ||||
(random() % 100000) < memguard_frequency) { | (arc4random() % 100000) < memguard_frequency) { | ||||
cem: I don’t believe there’s much reason to use arc4random here. | |||||
Done Inline ActionsThis is the case with basically all the above changes ;). pfg: This is the case with basically all the above changes ;). | |||||
memguard_frequency_hits++; | memguard_frequency_hits++; | ||||
return (1); | return (1); | ||||
} | } | ||||
return (0); | return (0); | ||||
} | } | ||||
int | int | ||||
▲ Show 20 Lines • Show All 47 Lines • Show Last 20 Lines |
I don’t believe there’s much reason to use arc4random here.