Subject: Re: CVS commit: src/sys/kern
To: Christos Zoulas <firstname.lastname@example.org>
From: Elad Efrat <elad@NetBSD.org>
Date: 12/26/2006 17:55:02
Christos Zoulas wrote:
> In article <45911FC7.1010003@NetBSD.org>, Elad Efrat <elad@NetBSD.org> wrote:
>> Arnaud Lacombe wrote:
>>> Module Name: src
>>> Committed By: alc
>>> Date: Tue Dec 26 00:10:40 UTC 2006
>>> Modified Files:
>>> src/sys/kern: kern_sa.c
>>> Log Message:
>>> CID-4284: check for 'kup != NULL' after kmem_zalloc() returns
>> this coverity issue is false, please revert.
> kmem_zalloc mentions that if we sleep it will not return a failure.
> On the other hand, it could be the case that the memory allocator
> can detect a case where it will never be able to allocate the
> requested storage, so in this case it is better to return NULL.
I'm not sure I'd like to see a NULL returned rather than a panic
if the allocation cannot be satisfied. memory shortage, today, should
be pretty rare, and imho would indicate either some corruption (integer
overflow?) or a memory leak or who knows what.
also, can kmem_zalloc() return NULL if its passed KM_SLEEP? brief
code inspection suggests that no, but if the docs say....