diff options
| author | Takashi Iwai <tiwai@suse.de> | 2023-03-03 14:20:56 +0100 |
|---|---|---|
| committer | Takashi Iwai <tiwai@suse.de> | 2023-03-03 14:20:56 +0100 |
| commit | 26ed1d29fc44f3f2f0c396c1392abefac5f0454e (patch) | |
| tree | ffba9ebddf759f04cbeca8adace5cc8093c58c2d /include/linux/util_macros.h | |
| parent | e97fc9cffbb9f372b53b42c36cd7b20aab44a554 (diff) | |
| parent | 7933b90b42896f5b6596e6a829bb31c5121fc2a9 (diff) | |
Merge branch 'for-next' into for-linus
Diffstat (limited to 'include/linux/util_macros.h')
| -rw-r--r-- | include/linux/util_macros.h | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/include/linux/util_macros.h b/include/linux/util_macros.h index 72299f261b25..43db6e47503c 100644 --- a/include/linux/util_macros.h +++ b/include/linux/util_macros.h @@ -38,4 +38,16 @@ */ #define find_closest_descending(x, a, as) __find_closest(x, a, as, >=) +/** + * is_insidevar - check if the @ptr points inside the @var memory range. + * @ptr: the pointer to a memory address. + * @var: the variable which address and size identify the memory range. + * + * Evaluates to true if the address in @ptr lies within the memory + * range allocated to @var. + */ +#define is_insidevar(ptr, var) \ + ((uintptr_t)(ptr) >= (uintptr_t)(var) && \ + (uintptr_t)(ptr) < (uintptr_t)(var) + sizeof(var)) + #endif |
