Page Menu
Home
FreeBSD
Search
Configure Global Search
Log In
Files
F107281618
D39372.id120471.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Flag For Later
Award Token
Size
949 B
Referenced Files
None
Subscribers
None
D39372.id120471.diff
View Options
diff --git a/sys/kern/subr_lock.c b/sys/kern/subr_lock.c
--- a/sys/kern/subr_lock.c
+++ b/sys/kern/subr_lock.c
@@ -121,14 +121,14 @@
lock_delay(struct lock_delay_arg *la)
{
struct lock_delay_config *lc = la->config;
- u_short i;
+ u_int i;
for (i = la->delay; i > 0; i--)
cpu_spinwait();
la->spin_cnt += la->delay;
la->delay <<= 1;
- if (__predict_false(la->delay > lc->max))
+ if (__predict_false(la->delay > (u_int)lc->max))
la->delay = lc->max;
}
@@ -148,9 +148,7 @@
{
lc->base = 1;
- lc->max = lock_roundup_2(mp_ncpus) * 256;
- if (lc->max > 32678)
- lc->max = 32678;
+ lc->max = min(lock_roundup_2(mp_ncpus) * 256, SHRT_MAX);
}
struct lock_delay_config __read_frequently locks_delay;
diff --git a/sys/sys/lock.h b/sys/sys/lock.h
--- a/sys/sys/lock.h
+++ b/sys/sys/lock.h
@@ -182,7 +182,7 @@
struct lock_delay_arg {
struct lock_delay_config *config;
- u_short delay;
+ u_int delay;
u_int spin_cnt;
};
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Sun, Jan 12, 10:41 PM (12 h, 52 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
15773402
Default Alt Text
D39372.id120471.diff (949 B)
Attached To
Mode
D39372: Fix two potential overflows in the lock delay code
Attached
Detach File
Event Timeline
Log In to Comment