(not) Protecting of case IP_FW_GET.

Pawel Malachowski pawmal-posting at freebsd.lublin.pl
Wed Aug 25 04:40:14 PDT 2004


On Wed, Aug 25, 2004 at 01:19:11PM +0200, Maxime Henrion wrote:

> > Another thing, in HEAD, there are three mallocs with M_WAITOK flag, only
> > one of them checks if malloc succeed (lookup tables code) and returns
> > ENOMEM, if not. Another two are assuming malloc will always succeed.
> > In RELENG_4, result is checked and ENOBUFS (why not ENOMEM?) is returned
> > if malloc failed.
> 
> The case where it checks the return value of malloc() is wrong.  When
> called with the M_WAITOK flag, malloc() is not supposed to return NULL.

malloc(9) states that. What would happen, if one tries to malloc more
memory than we physically have, with M_WAITOK flag -- will it eat all
available memory and wait forever for more?


-- 
Paweł Małachowski


More information about the freebsd-ipfw mailing list