Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

mips: replace arch specific way to determine 32bit task with generic version

Mips uses TASK_IS_32BIT_ADDR to determine if a task is 32bit, but this
define is mips specific and other arches do not have it: instead, use
!IS_ENABLED(CONFIG_64BIT) || is_compat_task() condition.

Link: http://lkml.kernel.org/r/20190730055113.23635-13-alex@ghiti.fr
Signed-off-by: Alexandre Ghiti <alex@ghiti.fr>
Acked-by: Paul Burton <paul.burton@mips.com>
Reviewed-by: Kees Cook <keescook@chromium.org>
Reviewed-by: Luis Chamberlain <mcgrof@kernel.org>
Cc: Albert Ou <aou@eecs.berkeley.edu>
Cc: Alexander Viro <viro@zeniv.linux.org.uk>
Cc: Catalin Marinas <catalin.marinas@arm.com>
Cc: Christoph Hellwig <hch@infradead.org>
Cc: Christoph Hellwig <hch@lst.de>
Cc: James Hogan <jhogan@kernel.org>
Cc: Palmer Dabbelt <palmer@sifive.com>
Cc: Ralf Baechle <ralf@linux-mips.org>
Cc: Russell King <linux@armlinux.org.uk>
Cc: Will Deacon <will.deacon@arm.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>

authored by

Alexandre Ghiti and committed by
Linus Torvalds
09036468 e548599f

+2 -1
+2 -1
arch/mips/mm/mmap.c
··· 17 17 #include <linux/sched/signal.h> 18 18 #include <linux/sched/mm.h> 19 19 #include <linux/sizes.h> 20 + #include <linux/compat.h> 20 21 21 22 unsigned long shm_align_mask = PAGE_SIZE - 1; /* Sane caches */ 22 23 EXPORT_SYMBOL(shm_align_mask); ··· 192 191 193 192 rnd = rnd << PAGE_SHIFT; 194 193 /* 32MB for 32bit, 1GB for 64bit */ 195 - if (TASK_IS_32BIT_ADDR) 194 + if (!IS_ENABLED(CONFIG_64BIT) || is_compat_task()) 196 195 rnd = rnd & (SZ_32M - 1); 197 196 else 198 197 rnd = rnd & (SZ_1G - 1);