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>
This commit is contained in:
parent
603b892200
commit
ef85dffd42
|
@ -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
|
||||
|
||||
|
|
Loading…
Reference in New Issue