MCPcopy Create free account
hub / github.com/F-Stack/f-stack / mtrash_ctor

Function mtrash_ctor

freebsd/vm/uma_dbg.c:141–166  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

139}
140
141int
142mtrash_ctor(void *mem, int size, void *arg, int flags)
143{
144 struct malloc_type **ksp;
145 uint32_t *p = mem;
146 int cnt;
147
148#ifdef DEBUG_MEMGUARD
149 if (is_memguard_addr(mem))
150 return (0);
151#endif
152
153 size -= sizeof(struct malloc_type *);
154 ksp = (struct malloc_type **)mem;
155 ksp += size / sizeof(struct malloc_type *);
156 cnt = size / sizeof(uma_junk);
157
158 for (p = mem; cnt > 0; cnt--, p++)
159 if (*p != uma_junk) {
160 printf("Memory modified after free %p(%d) val=%x @ %p\n",
161 mem, size, *p, p);
162 panic("Most recently used by %s\n", (*ksp == NULL)?
163 "none" : (*ksp)->ks_shortdesc);
164 }
165 return (0);
166}
167
168/*
169 * Fills an item with predictable garbage

Callers 1

mtrash_finiFunction · 0.85

Calls 3

is_memguard_addrFunction · 0.85
printfFunction · 0.50
panicFunction · 0.50

Tested by

no test coverage detected