diff --git a/include/asm-generic/sections.h b/include/asm-generic/sections.h index 4df64a1fc09e..09e9fd061ac0 100644 --- a/include/asm-generic/sections.h +++ b/include/asm-generic/sections.h @@ -87,7 +87,7 @@ static inline bool memory_contains(void *begin, void *end, void *virt, /** * memory_intersects - checks if the region occupied by an object intersects * with another memory region - * @begin: virtual address of the beginning of the memory regien + * @begin: virtual address of the beginning of the memory region * @end: virtual address of the end of the memory region * @virt: virtual address of the memory object * @size: size of the memory object @@ -100,7 +100,10 @@ static inline bool memory_intersects(void *begin, void *end, void *virt, { void *vend = virt + size; - return (virt >= begin && virt < end) || (vend >= begin && vend < end); + if (virt < end && vend > begin) + return true; + + return false; } /**