/* * Checking whether a pointer is valid for user space access. * These definitions work on most architectures, but overrides can * be used where necessary.
*/
/* * architectures with compat tasks have a variable TASK_SIZE and should * override this to a constant.
*/ #ifndef TASK_SIZE_MAX #define TASK_SIZE_MAX TASK_SIZE #endif
#ifndef __access_ok /* * 'size' is a compile-time constant for most callers, so optimize for * this case to turn the check into a single comparison against a constant * limit and catch all possible overflows. * On architectures with separate user address space (m68k, s390, parisc, * sparc64) or those without an MMU, this should always return true. * * This version was originally contributed by Jonas Bonn for the * OpenRISC architecture, and was found to be the most efficient * for constant 'size' and 'limit' values.
*/ staticinlineint __access_ok(constvoid __user *ptr, unsignedlong size)
{ unsignedlong limit = TASK_SIZE_MAX; unsignedlong addr = (unsignedlong)ptr;
if (IS_ENABLED(CONFIG_ALTERNATE_USER_ADDRESS_SPACE) ||
!IS_ENABLED(CONFIG_MMU)) returntrue;
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.