Page Menu
Home
FreeBSD
Search
Configure Global Search
Log In
Files
F131868848
D42263.id129063.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Flag For Later
Award Token
Size
1 KB
Referenced Files
None
Subscribers
None
D42263.id129063.diff
View Options
diff --git a/sys/vm/uma_core.c b/sys/vm/uma_core.c
--- a/sys/vm/uma_core.c
+++ b/sys/vm/uma_core.c
@@ -3249,19 +3249,31 @@
return (zone_alloc_item(kegs, &args, UMA_ANYDOMAIN, M_WAITOK));
}
-/* Public functions */
-/* See uma.h */
-void
-uma_set_cache_align_mask(unsigned int mask)
+
+static void
+check_align_mask(unsigned int mask)
{
+ KASSERT(powerof2(mask + 1),
+ ("UMA: %s: Not the mask of a power of 2 (%#x)", __func__, mask));
/*
* Make sure the stored align mask doesn't have its highest bit set,
* which would cause implementation-defined behavior when passing it as
* the 'align' argument of uma_zcreate(). Such very large alignments do
* not make sense anyway.
*/
- uma_cache_align_mask = mask & ~(1U << 31);
+ KASSERT(!(mask & (1U << 31)),
+ ("UMA: %s: Mask too big (%#x)", __func__, mask));
+}
+
+/* Public functions */
+/* See uma.h */
+void
+uma_set_cache_align_mask(unsigned int mask)
+{
+
+ check_align_mask(mask);
+ uma_cache_align_mask = mask;
}
unsigned int
@@ -3279,8 +3291,7 @@
struct uma_zctor_args args;
uma_zone_t res;
- KASSERT(powerof2(align + 1), ("invalid zone alignment %d for \"%s\"",
- align, name));
+ check_align_mask(align);
/* This stuff is essential for the zone ctor */
memset(&args, 0, sizeof(args));
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Sun, Oct 12, 8:19 PM (3 h, 52 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
23621055
Default Alt Text
D42263.id129063.diff (1 KB)
Attached To
Mode
D42263: uma: New check_align_mask(): Validate alignments (INVARIANTS)
Attached
Detach File
Event Timeline
Log In to Comment