Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 24 Jan 2018 10:48:43 -0800
From:      Conrad Meyer <cem@freebsd.org>
To:        Hans Petter Selasky <hps@selasky.org>
Cc:        src-committers <src-committers@freebsd.org>, svn-src-all@freebsd.org,  svn-src-head@freebsd.org
Subject:   Re: svn commit: r328218 - in head/sys: amd64/amd64 arm/xscale/ixp425 arm64/arm64 cam cam/ctl compat/ndis dev/aacraid dev/advansys dev/ath dev/beri/virtio dev/bnxt dev/bwn dev/ciss dev/cxgbe/crypto dev/...
Message-ID:  <CAG6CVpWpZy06RrNo2hmDDeo1o3ZoQUAXsNBFBXLnB4VDdW0otg@mail.gmail.com>
In-Reply-To: <2aa48cbd-247a-66cd-b486-02ee77ec2e96@selasky.org>
References:  <201801211542.w0LFgbsp005980@repo.freebsd.org> <CAG6CVpXxuFyHS11rF=NF6bSSkC2=xnDh=WnbK-aWp4sOomrZ7w@mail.gmail.com> <51ff8aef-5660-7857-e4d5-12cdc77bc071@FreeBSD.org> <20180124182548.X1063@besplex.bde.org> <CANCZdfpL7t_J6xXi8w%2BwtxE%2B4x8EA0AzqzQKno=dUKaJ_NXFrw@mail.gmail.com> <CAG6CVpWv32FjZggRCM3JNWCsMDOSXbVzQfP-dh73fei6Hqr5Mw@mail.gmail.com> <1516817048.42536.182.camel@freebsd.org> <CAG6CVpUpVLe5f=As44TOyePDTy-7LaTKA=rCkk-NjZvZkA5nQg@mail.gmail.com> <CANCZdfqZ5ZiMceh7NZ-YpbgsTW6gqwcxVun0XM_bY2%2BFpustKQ@mail.gmail.com> <2aa48cbd-247a-66cd-b486-02ee77ec2e96@selasky.org>

next in thread | previous in thread | raw e-mail | index | archive | help
On Wed, Jan 24, 2018 at 10:40 AM, Hans Petter Selasky <hps@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



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?CAG6CVpWpZy06RrNo2hmDDeo1o3ZoQUAXsNBFBXLnB4VDdW0otg>