tech-kern archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

Re: kmem_alloc(0, f)



On Mon, Jul 31, 2017 at 10:13:28PM +0000, Taylor R Campbell wrote:
> On reflection, perhaps the danger of kmem_alloc(0, f) would be
> rendered moot by having a kmem array API that gracefully handles empty
> arrays.

An empty array still is 99% of the times a driver bug and simply caught
when first trying the driver. All other call sides can simply avoid the
allocation and use a NULL pointer instead.

All drivers that do not properly check bounds on userland supplied ranges
are a different story, but making the kmem* operation succeed will only
paper over it and hide issues.

Martin


Home | Main Index | Thread Index | Old Index