Page Menu
Home
FreeBSD
Search
Configure Global Search
Log In
Files
F101531650
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
Fri, Nov 1, 12:41 AM (19 h, 16 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
14387864
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