[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CAHk-=wj=zTfrjXbFp+yhMpjH5jyx=t5fcDVmYN6KpE9Tjxb9YA@mail.gmail.com>
Date: Mon, 6 Apr 2020 10:33:35 -0700
From: Linus Torvalds <torvalds@...ux-foundation.org>
To: Joe Perches <joe@...ches.com>
Cc: David Howells <dhowells@...hat.com>,
Waiman Long <longman@...hat.com>,
Andrew Morton <akpm@...ux-foundation.org>,
Jarkko Sakkinen <jarkko.sakkinen@...ux.intel.com>,
James Morris <jmorris@...ei.org>,
"Serge E. Hallyn" <serge@...lyn.com>,
Linux-MM <linux-mm@...ck.org>, keyrings@...r.kernel.org,
Linux Kernel Mailing List <linux-kernel@...r.kernel.org>
Subject: Re: [PATCH] mm: Add kvfree_sensitive() for freeing sensitive data objects
On Mon, Apr 6, 2020 at 10:22 AM Joe Perches <joe@...ches.com> wrote:
>
> API function naming symmetry is good.
BS.
Naming should be symmetric if _use_ is symmetric.
But if the use is completely different, then the naming should be
completely different too.
A symmetric naming is only helpful if it implies symmetries in use.
Otherwise it's actively misleading.
In "kzalloc()", the z is meaningful and an important part of what the
caller wants.
In "kzfree()", the z is actively detrimental, because maybe in the
future we really _might_ want to use that "memfill(0xdeadbeef)" or
something. The "zero" part of the interface isn't even _relevant_.
See? There is no API symmetry. There is only a small and immaterial
implementation detail.
We don't put an "l" into the kfree/kmalloc names because they
internally use a percpu list to manage the allocations, do we? That's
a "symmetry" too. But it's an irrelevant implementation detail that
makes no sense to the caller.
Linus
Powered by blists - more mailing lists