In message <[EMAIL PROTECTED]>, Kris Kennaway writes:

>I just got the following on axp1:
>
>panic: malloc(M_WAITOK) returned NULL
>db_print_backtrace() at db_print_backtrace+0x18
>panic() at panic+0x104
>malloc() at malloc+0x1a8
>initiate_write_inodeblock_ufs1() at initiate_write_inodeblock_ufs1+0xc4
>softdep_disk_io_initiation() at softdep_disk_io_initiation+0xa4
>spec_strategy() at spec_strategy+0x158
>spec_vnoperate() at spec_vnoperate+0x2c

This is a bug in the kernel memory allocator, since it should not be
able to return NULL when M_WAITOK is specified.  The potential bugs
are more likely because M_WAITOK is defined as zero.

     M_WAITOK
             Indicates that it is Ok to wait for resources.  It is unconve-
             niently defined as 0 so care should be taken never to compare
             against this value directly or try to AND it as a flag.  The
             default operation is to block until the memory allocation suc-
             ceeds.  malloc(), realloc(), and reallocf() can only return NULL
             if M_NOWAIT is specified.


        void *   
        malloc(size, type, flags)
                unsigned long size;
                struct malloc_type *type;
                int flags;
        {
                [...]
                if (!(flags & M_NOWAIT))
                        KASSERT(va != NULL, ("malloc(M_WAITOK) returned NULL"));
                [...]
        }



-- 
Poul-Henning Kamp       | UNIX since Zilog Zeus 3.20
[EMAIL PROTECTED]         | TCP/IP since RFC 956
FreeBSD committer       | BSD since 4.3-tahoe    
Never attribute to malice what can adequately be explained by incompetence.

To Unsubscribe: send mail to [EMAIL PROTECTED]
with "unsubscribe freebsd-current" in the body of the message

Reply via email to