Page Menu
Home
FreeBSD
Search
Configure Global Search
Log In
Files
F103077221
D47309.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
D47309.diff
View Options
diff --git a/sys/kern/kern_malloc.c b/sys/kern/kern_malloc.c
--- a/sys/kern/kern_malloc.c
+++ b/sys/kern/kern_malloc.c
@@ -524,27 +524,13 @@
malloc_dbg(caddr_t *vap, size_t *sizep, struct malloc_type *mtp,
int flags)
{
-#ifdef INVARIANTS
- int indx;
-
KASSERT(mtp->ks_version == M_VERSION, ("malloc: bad malloc type version"));
- /*
- * Check that exactly one of M_WAITOK or M_NOWAIT is specified.
- */
- indx = flags & (M_WAITOK | M_NOWAIT);
- if (indx != M_NOWAIT && indx != M_WAITOK) {
- static struct timeval lasterr;
- static int curerr, once;
- if (once == 0 && ppsratecheck(&lasterr, &curerr, 1)) {
- printf("Bad malloc flags: %x\n", indx);
- kdb_backtrace();
- flags |= M_WAITOK;
- once++;
- }
- }
+ KASSERT((flags & (M_WAITOK | M_NOWAIT)) != 0,
+ ("malloc: flags must include either M_WAITOK or M_NOWAIT"));
+ KASSERT((flags & (M_WAITOK | M_NOWAIT)) != (M_WAITOK | M_NOWAIT),
+ ("malloc: flags may not include both M_WAITOK and M_NOWAIT"));
KASSERT((flags & M_NEVERFREED) == 0,
("malloc: M_NEVERFREED is for internal use only"));
-#endif
#ifdef MALLOC_MAKE_FAILURES
if ((flags & M_NOWAIT) && (malloc_failure_rate != 0)) {
atomic_add_int(&malloc_nowait_count, 1);
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Thu, Nov 21, 3:35 PM (22 h, 10 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
14403510
Default Alt Text
D47309.diff (1 KB)
Attached To
Mode
D47309: malloc(9): assert wait flags.
Attached
Detach File
Event Timeline
Log In to Comment