[PATCH v2 13/18] uaccess: generalize access_ok()

Arnd Bergmann arnd at kernel.org
Fri Feb 18 18:23:29 AEDT 2022


On Fri, Feb 18, 2022 at 7:34 AM Christoph Hellwig <hch at lst.de> wrote:
>
> > +#include <asm-generic/access_ok.h>
>
> Instead of the asm-generic games, shouldn't we just define access_ok in
> <linux/uaccess.h> if not already defined by the architecture?

I tried, but couldn't actually make it work because asm/uaccess.h tends
to contain inline functions that rely on access_ok(). It could work once we
move all the high-level functions into linux/uaccess.h, but that would likely
require another long patch series.

One option that can work is to require architectures to have an
asm/access_ok.h header that gets included by linux/uaccess.h.
On most architectures, that would be redirected to
asm-generic/access_ok.h, as only ia64, x86, arm64 and um
need to override the definition.

      Arnd


More information about the Linuxppc-dev mailing list