Use rlimit() helper instead of manually writing whole chain from current task to rlim_cur Signed-off-by: Krzysztof Opasiak <k.opasiak@xxxxxxxxxxx> --- fs/exec.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/fs/exec.c b/fs/exec.c index 904199086490..964e34e307df 100644 --- a/fs/exec.c +++ b/fs/exec.c @@ -221,7 +221,6 @@ static struct page *get_arg_page(struct linux_binprm *bprm, unsigned long pos, if (write) { unsigned long size = bprm->vma->vm_end - bprm->vma->vm_start; unsigned long ptr_size; - struct rlimit *rlim; /* * Since the stack will hold pointers to the strings, we @@ -256,8 +255,7 @@ static struct page *get_arg_page(struct linux_binprm *bprm, unsigned long pos, * - the program will have a reasonable amount of stack left * to work from. */ - rlim = current->signal->rlim; - if (size > READ_ONCE(rlim[RLIMIT_STACK].rlim_cur) / 4) + if (size > rlimit(RLIMIT_STACK) / 4) goto fail; } -- 2.9.3