Re: [PATCH v2 2/2] mm: kvmalloc: align kvrealloc() with krealloc()
From: Danilo Krummrich
Date: Tue Jul 23 2024 - 10:05:27 EST
On Mon, Jul 22, 2024 at 06:43:48PM -0700, Andrew Morton wrote:
> On Mon, 22 Jul 2024 18:29:24 +0200 Danilo Krummrich <dakr@xxxxxxxxxx> wrote:
>
> > Besides the obvious (and desired) difference between krealloc() and
> > kvrealloc(), there is some inconsistency in their function signatures
> > and behavior:
> >
> > - krealloc() frees the memory when the requested size is zero, whereas
> > kvrealloc() simply returns a pointer to the existing allocation.
>
> The old kvrealloc() behavior actually sounds somewhat useful. You've
> checked that no existing sites were relying on this?
Yes, I did.
>
> And that all existing kvrealloc() callers were (incorrectly) checking
> for NULL? Seems that way.
You mean for the initial allocation? Yes, but I also noticed that as long as the
old kvrealloc() is called with p == NULL and oldsize == 0 it should work as
well.