Commit 4bf936b9e484bb8ee5f32bfd1351893810864f58

Authored by Jiri Slaby
Committed by Benjamin Herrenschmidt
1 parent c81b812a33

powerpc: Use helpers for rlimits

Make sure compiler won't do weird things with limits. E.g. fetching
them twice may return 2 different values after writable limits are
implemented.

I.e. either use rlimit helpers added in
3e10e716abf3c71bdb5d86b8f507f9e72236c9cd
or ACCESS_ONCE if not applicable.

Signed-off-by: Jiri Slaby <jslaby@suse.cz>
Cc: Benjamin Herrenschmidt <benh@kernel.crashing.org>
Cc: Paul Mackerras <paulus@samba.org>
Cc: linuxppc-dev@ozlabs.org
Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>

Showing 2 changed files with 3 additions and 3 deletions Side-by-side Diff

arch/powerpc/mm/mmap_64.c
... ... @@ -47,7 +47,7 @@
47 47 if (current->personality & ADDR_COMPAT_LAYOUT)
48 48 return 1;
49 49  
50   - if (current->signal->rlim[RLIMIT_STACK].rlim_cur == RLIM_INFINITY)
  50 + if (rlimit(RLIMIT_STACK) == RLIM_INFINITY)
51 51 return 1;
52 52  
53 53 return sysctl_legacy_va_layout;
... ... @@ -77,7 +77,7 @@
77 77  
78 78 static inline unsigned long mmap_base(void)
79 79 {
80   - unsigned long gap = current->signal->rlim[RLIMIT_STACK].rlim_cur;
  80 + unsigned long gap = rlimit(RLIMIT_STACK);
81 81  
82 82 if (gap < MIN_GAP)
83 83 gap = MIN_GAP;
arch/powerpc/platforms/cell/spufs/coredump.c
... ... @@ -54,7 +54,7 @@
54 54 */
55 55 static int spufs_dump_write(struct file *file, const void *addr, int nr, loff_t *foffset)
56 56 {
57   - unsigned long limit = current->signal->rlim[RLIMIT_CORE].rlim_cur;
  57 + unsigned long limit = rlimit(RLIMIT_CORE);
58 58 ssize_t written;
59 59  
60 60 if (*foffset + nr > limit)