aboutsummaryrefslogtreecommitdiffstats
path: root/arch/ia64
diff options
context:
space:
mode:
authorAl Viro <viro@zeniv.linux.org.uk>2009-12-03 19:59:24 -0500
committerAl Viro <viro@zeniv.linux.org.uk>2009-12-11 06:44:58 -0500
commitbb52d6694002b9d632bb355f64daa045c6293a4e (patch)
tree526b8fb0a6db6ef002d94d8b7bca26b5451d39ec /arch/ia64
parent05d72faa6d13c9d857478a5d35c85db9adada685 (diff)
Get rid of open-coding in ia64_brk()
The comment in there used to be true, but these days do_brk() does the arch-specific check that covers what we open-coded here. So we can use sys_brk() just fine, only need to do force_successful_syscall_return() after it. See commit 3a459756810912d2c2bf188cef566af255936b4d - that's when the checks in do_brk() had been originally added. Acked-by: Hugh Dickins <hugh.dickins@tiscali.co.uk> Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
Diffstat (limited to 'arch/ia64')
-rw-r--r--arch/ia64/kernel/sys_ia64.c46
1 files changed, 1 insertions, 45 deletions
diff --git a/arch/ia64/kernel/sys_ia64.c b/arch/ia64/kernel/sys_ia64.c
index ae384a2974c2..609d50056a6c 100644
--- a/arch/ia64/kernel/sys_ia64.c
+++ b/arch/ia64/kernel/sys_ia64.c
@@ -100,51 +100,7 @@ sys_getpagesize (void)
100asmlinkage unsigned long 100asmlinkage unsigned long
101ia64_brk (unsigned long brk) 101ia64_brk (unsigned long brk)
102{ 102{
103 unsigned long rlim, retval, newbrk, oldbrk; 103 unsigned long retval = sys_brk(brk);
104 struct mm_struct *mm = current->mm;
105
106 /*
107 * Most of this replicates the code in sys_brk() except for an additional safety
108 * check and the clearing of r8. However, we can't call sys_brk() because we need
109 * to acquire the mmap_sem before we can do the test...
110 */
111 down_write(&mm->mmap_sem);
112
113 if (brk < mm->end_code)
114 goto out;
115 newbrk = PAGE_ALIGN(brk);
116 oldbrk = PAGE_ALIGN(mm->brk);
117 if (oldbrk == newbrk)
118 goto set_brk;
119
120 /* Always allow shrinking brk. */
121 if (brk <= mm->brk) {
122 if (!do_munmap(mm, newbrk, oldbrk-newbrk))
123 goto set_brk;
124 goto out;
125 }
126
127 /* Check against unimplemented/unmapped addresses: */
128 if ((newbrk - oldbrk) > RGN_MAP_LIMIT || REGION_OFFSET(newbrk) > RGN_MAP_LIMIT)
129 goto out;
130
131 /* Check against rlimit.. */
132 rlim = current->signal->rlim[RLIMIT_DATA].rlim_cur;
133 if (rlim < RLIM_INFINITY && brk - mm->start_data > rlim)
134 goto out;
135
136 /* Check against existing mmap mappings. */
137 if (find_vma_intersection(mm, oldbrk, newbrk+PAGE_SIZE))
138 goto out;
139
140 /* Ok, looks good - let it rip. */
141 if (do_brk(oldbrk, newbrk-oldbrk) != oldbrk)
142 goto out;
143set_brk:
144 mm->brk = brk;
145out:
146 retval = mm->brk;
147 up_write(&mm->mmap_sem);
148 force_successful_syscall_return(); 104 force_successful_syscall_return();
149 return retval; 105 return retval;
150} 106}