On Sun, Jul 30, 2017 at 03:30:59PM -, Michael van Elst wrote:
> Reallocation is usually a reason for memory fragmentation. I would
> rather try to avoid it instead of making it easier.
Agreeed. Also for kernel drivers, resizing an array allocation is
a very rare operation and no good reason to
On 30.07.2017 16:51, Taylor R Campbell wrote:
>> Date: Sun, 30 Jul 2017 16:24:07 +0200
>> From: Kamil Rytarowski
>>
>> I would allow size to be 0, like with the original reallocarr(3). It
>> might be less pretty, but more compatible with the original model and
>> less vulnerable to accidental pani
campbell+netbsd-tech-k...@mumble.net (Taylor R Campbell) writes:
>Initially I was reluctant to do that because (a) we don't even have a
>kmem_realloc, perhaps for some particular reason, and (b) it requires
>an extra parameter for the old size. But I don't know any particular
>reason in (a), and
> Date: Sun, 30 Jul 2017 16:24:07 +0200
> From: Kamil Rytarowski
>
> I would allow size to be 0, like with the original reallocarr(3). It
> might be less pretty, but more compatible with the original model and
> less vulnerable to accidental panics for no good reason.
Hard to imagine a legitimat
On 30.07.2017 15:45, Taylor R Campbell wrote:
>> Date: Sun, 30 Jul 2017 10:22:11 +0200
>> From: Kamil Rytarowski
>>
>> I think we should go for kmem_reallocarr(). It has been designed for
>> overflows like realocarray(3) with an option to be capable to resize a
>> table fron 1 to N elements and ba
> Date: Sun, 30 Jul 2017 10:22:11 +0200
> From: Kamil Rytarowski
>
> I think we should go for kmem_reallocarr(). It has been designed for
> overflows like realocarray(3) with an option to be capable to resize a
> table fron 1 to N elements and back from N to 0 including freeing.
Initially I was
On 29.07.2017 16:19, Taylor R Campbell wrote:
> It's stupid that we have to litter drivers with
>
> if (SIZE_MAX/sizeof(struct xyz_cookie) < iocmd->ncookies) {
> error = EINVAL;
> goto out;
> }
> cookies = kmem_alloc(iocmd->ncookies*sizeof(struct xyz_c
It's stupid that we have to litter drivers with
if (SIZE_MAX/sizeof(struct xyz_cookie) < iocmd->ncookies) {
error = EINVAL;
goto out;
}
cookies = kmem_alloc(iocmd->ncookies*sizeof(struct xyz_cookie),
KM_SLEEP);
...
and as