https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=209475

--- Comment #17 from Kristof Provost <k...@freebsd.org> ---
(In reply to fehmi noyan isi from comment #16)
Yes, absolutely. The potential for integer overflow is a separate issue.

I wouldn't try check_if_we_have_enough_memory() though. Memory allocation is
very complicated and it's basically impossible to predict if there'd be enough
free memory to satisfy a request without actually doing it. Moreover, it'd
always be susceptible to races.

I'd try to allocate the requested size with malloc(size * sizeof(foo),
M_NOWAIT). If that fails we can fall back on malloc(DEFAULT_SIZE * sizeof(foo),
M_WAITOK). Even that allocation might block forever, but at that point the
system is so low on memory that we'll be in all sorts of trouble.

-- 
You are receiving this mail because:
You are the assignee for the bug.
_______________________________________________
freebsd-pf@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/freebsd-pf
To unsubscribe, send any mail to "freebsd-pf-unsubscr...@freebsd.org"

Reply via email to