lkml.org 
[lkml]   [2007]   [Oct]   [26]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [PATCH] [RFC] brk randomization: compute RLIMIT_DATA properly (was Re: x86: randomize brk() and RLIMIT_DATA)
On Fri, 26 Oct 2007, Jan Engelhardt wrote:
> On Oct 26 2007 13:30, Hugh Dickins wrote:
> >> @@ -251,7 +251,8 @@ asmlinkage unsigned long sys_brk(unsigned long brk)
> >> * not page aligned -Ram Gupta
> >> */
> >> rlim = current->signal->rlim[RLIMIT_DATA].rlim_cur;
> >> - if (rlim < RLIM_INFINITY && brk - mm->start_data > rlim)
> >> + if (rlim < RLIM_INFINITY && (brk - mm->start_brk) +
> >> + (mm->end_data - mm->start_data) > rlim)
> >> goto out;
> >>
> >> newbrk = PAGE_ALIGN(brk);
>
> Parentheses around (brk - mm->start_brk) + (mm->end_data - mm->start_data)
> not strictly necessary.

Yes, but don't you find they make it easier to understand the expression?

Hugh
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/

\
 
 \ /
  Last update: 2007-10-26 15:29    [W:0.054 / U:1.008 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site