diff options
author | Mathieu Malaterre <malat@debian.org> | 2018-03-02 20:50:51 +0100 |
---|---|---|
committer | Michael Ellerman <mpe@ellerman.id.au> | 2018-03-13 05:50:41 +0100 |
commit | ef85dffd4251ff6c23056651f6f83bdce83cd1cf (patch) | |
tree | 831767727f20622f70b91eeab2966bb9e77284de /arch | |
parent | powerpc: Avoid comparison of unsigned long >= 0 in pfn_valid() (diff) | |
download | linux-ef85dffd4251ff6c23056651f6f83bdce83cd1cf.tar.xz linux-ef85dffd4251ff6c23056651f6f83bdce83cd1cf.zip |
powerpc: Avoid comparison of unsigned long >= 0 in __access_ok()
Rewrite function-like macro into regular static inline function to
avoid a warning during macro expansion.
Fix warning (treated as error in W=1):
./arch/powerpc/include/asm/uaccess.h:52:35: error: comparison of unsigned expression >= 0 is always true
(((size) == 0) || (((size) - 1) <= ((segment).seg - (addr)))))
^
Suggested-by: Segher Boessenkool <segher@kernel.crashing.org>
Signed-off-by: Mathieu Malaterre <malat@debian.org>
Reviewed-by: Christophe Leroy <christophe.leroy@c-s.fr>
Signed-off-by: Michael Ellerman <mpe@ellerman.id.au>
Diffstat (limited to 'arch')
-rw-r--r-- | arch/powerpc/include/asm/uaccess.h | 10 |
1 files changed, 7 insertions, 3 deletions
diff --git a/arch/powerpc/include/asm/uaccess.h b/arch/powerpc/include/asm/uaccess.h index 51bfeb8777f0..a62ee663b2c8 100644 --- a/arch/powerpc/include/asm/uaccess.h +++ b/arch/powerpc/include/asm/uaccess.h @@ -47,9 +47,13 @@ #else -#define __access_ok(addr, size, segment) \ - (((addr) <= (segment).seg) && \ - (((size) == 0) || (((size) - 1) <= ((segment).seg - (addr))))) +static inline int __access_ok(unsigned long addr, unsigned long size, + mm_segment_t seg) +{ + if (addr > seg.seg) + return 0; + return (size == 0 || size - 1 <= seg.seg - addr); +} #endif |