Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1681668

[PATCH 3/4] fs: Use dedicated helper to access rlimit value

From Krzysztof Opasiak <k.opasiak@samsung.com>
Newsgroups linux.kernel
Subject [PATCH 3/4] fs: Use dedicated helper to access rlimit value
Date 2017-07-05 19:30 +0200
Message-ID <tZWhH-MR-1@gated-at.bofh.it> (permalink)
References <tZWhH-MR-3@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw


Use rlimit() helper instead of manually writing whole
chain from current task to rlim_cur

Signed-off-by: Krzysztof Opasiak <k.opasiak@samsung.com>
---
 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

Back to linux.kernel | Previous | Next | Find similar | Unroll thread


Thread

[PATCH 3/4] fs: Use dedicated helper to access rlimit value Krzysztof Opasiak <k.opasiak@samsung.com> - 2017-07-05 19:30 +0200

csiph-web