HomeFreeBSD

mallocarray(9): panic if the requested allocation would overflow

Description

mallocarray(9): panic if the requested allocation would overflow

Additionally, move the overflow check logic out to WOULD_OVERFLOW() for
consumers to have a common means of testing for overflowing allocations.
WOULD_OVERFLOW() should be a secondary check -- on 64-bit platforms, just
because an allocation won't overflow size_t does not mean it is a sane size
to request. Callers should be imposing reasonable allocation limits far,
far, below overflow.

Discussed with: emaste, jhb, kp
Sponsored by: Dell EMC Isilon

Details

Provenance
cemAuthored on
Parents
rS327795: Add a regression test for r327794.
Branches
Unknown
Tags
Unknown