On Wed, Jan 24, 2018 at 10:40 AM, Hans Petter Selasky <h...@selasky.org> wrote:
> On 01/24/18 19:28, Warner Losh wrote:
>>
>> Does mallocarray(10 ,1Gb) panic on i386? It does not. It should.
>
>
> Hi,
>
> If M_WAITOK is specified, then sleep forever and print a message.
> Else return NULL ?

Depends on the machine.  From malloc.9:

> If the multiplication of nmemb and size would cause an integer overflow, the 
> mallocarray() function induces a panic.

64-bit arch does not experience overflow and will sleep until 10GB is
available.  (This is why the caller should do a narrower check.)

32-bit panics, since 10 * 1GB overflows 32-bit size_t (== u_long).

Best,
Conrad
_______________________________________________
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"

Reply via email to