Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 19 Oct 2010 08:55:48 -0400
From:      John Baldwin <jhb@freebsd.org>
To:        freebsd-current@freebsd.org
Cc:        mdf@freebsd.org
Subject:   Re: uma_zfree(NULL) is broken
Message-ID:  <201010190855.48364.jhb@freebsd.org>
In-Reply-To: <AANLkTim=vYZR3SQ-AcOHtBn%2BeUendBexc1Xst0hEsfCV@mail.gmail.com>
References:  <AANLkTim=vYZR3SQ-AcOHtBn%2BeUendBexc1Xst0hEsfCV@mail.gmail.com>

next in thread | previous in thread | raw e-mail | index | archive | help
On Monday, October 18, 2010 4:59:17 pm mdf@freebsd.org wrote:
> There's explicit protection for free(NULL, M_FOO), but uma_zfree(zone,
> NULL) will put NULL in the local bucket and then probably return it
> later from a uma_zalloc call.  Obviously it's not a good idea to call
> uma_zfree(9) on NULL, but in this case it's an easy mistake to make
> when e.g. converting a set of malloc(9)/free(9) uses into uma(9).
> 
> So is the "right" thing to allow a uma_zfree(NULL) and silently
> succeed, like for free(9)?  That would be my guess, but I'm open to
> alternatives.

Given that free(3) and free(9) both handle NULL, I think it makes sense for 
uma_zfree() to do so as well.

-- 
John Baldwin



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201010190855.48364.jhb>