svn commit: r273552 - head/sys/kern
Bryan Drewery
bdrewery at FreeBSD.org
Thu Oct 23 23:31:08 UTC 2014
On 10/23/2014 6:21 PM, Mateusz Guzik wrote:
> On Thu, Oct 23, 2014 at 04:19:05PM -0700, Xin Li wrote:
>> -----BEGIN PGP SIGNED MESSAGE-----
>> Hash: SHA512
>>
>> On 10/23/14 15:47, Dag-Erling Smørgrav wrote:
>>> Xin LI <delphij at FreeBSD.org> writes:
>>>> Log: Test if 'env' is NULL before doing memset() and strlen(),
>>>> the caller may pass NULL to freeenv().
>>>
>>> If this is in response to a panic in early boot, the real bug is
>>> elsewhere (see r273564). Adding a NULL check here only hides it.
>>
>> Yes that would fix it. Does this look good to you?
>>
>> Index: sys/kern/kern_environment.c
>> ===================================================================
>> - --- sys/kern/kern_environment.c (revision 273564)
>> +++ sys/kern/kern_environment.c (working copy)
>> @@ -262,7 +262,8 @@ void
>> freeenv(char *env)
>> {
>>
>> - - if (dynamic_kenv && env != NULL) {
>> + MPASS(env != NULL);
>> + if (dynamic_kenv) {
>> memset(env, 0, strlen(env));
>> free(env, M_KENV);
>> }
>>
>
> There are at least 80 consumers of this function. Unless someone is up
> to reviewing them all, can we go with a warning + backtrace for the time
> being?
>
My DEBUG_WARN could be used for that. I had not committed yet, but it is
ready.
--
Regards,
Bryan Drewery
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 488 bytes
Desc: OpenPGP digital signature
URL: <http://lists.freebsd.org/pipermail/svn-src-head/attachments/20141023/05e64e46/attachment.sig>
More information about the svn-src-head
mailing list