Messages in this thread | | | Subject | Re: [PATCH 01/15] kmemleak: Add the base support | From | Pekka Enberg <> | Date | Fri, 12 Dec 2008 15:14:59 +0200 |
| |
On Fri, 2008-12-12 at 11:36 +0000, Catalin Marinas wrote: > On Fri, 2008-12-12 at 00:01 +0200, Pekka Enberg wrote: > > On Wed, Dec 10, 2008 at 8:26 PM, Catalin Marinas > > <catalin.marinas@arm.com> wrote: > > > +static void put_object(struct memleak_object *object) > > > +{ > > > + if (!atomic_dec_and_test(&object->use_count)) > > > + return; > > > + > > > + /* should only get here after delete_object was called */ > > > + BUG_ON(object->flags & OBJECT_ALLOCATED); > > > > This could be > > > > if (WARN_ON(object->flags & OBJECT_ALLOCATED)) > > return; > > I'm not sure just warning would be enough. If this happens, its a severe > bug in kmemleak and the tool is no longer useful (it could even leak > memory or free already freed blocks). I could change it to a > memleak_panic call but if the object use_count isn't reliable, the > memleak_disable call wouldn't work properly either.
Oh, we use WARN_ON() for things like this as well to maximize the likelihood of the oops actually reaching the user. But whatever works for you the best.
| |