lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [day] [month] [year] [list]
Date:	Thu, 10 Sep 2015 04:57:58 +0300
From:	Alexey Klimov <klimov.linux@...il.com>
To:	linux-mm@...ck.org
Cc:	linux-kernel@...r.kernel.org, jeffv@...gle.com,
	kirill.shutemov@...ux.intel.com, rientjes@...gle.com,
	akpm@...ux-foundation.org, alexey.klimov@...aro.org,
	yury.norov@...il.com, Alexey Klimov <klimov.linux@...il.com>
Subject: [PATCH] syscall/mlockall: reorganize return values and remove goto-out label

In mlockall syscall wrapper after out-label for goto code
just doing return. Remove goto out statements and return error
values directly.
Also instead of rewriting ret variable before every if-check
move returns to 'error'-like path under if-check.

Objdump asm listing showed me reducing by few asm lines.
Object file size descreased from 220592 bytes to 220528 bytes
for me (for aarch64).

Signed-off-by: Alexey Klimov <klimov.linux@...il.com>
---
 mm/mlock.c | 9 ++++-----
 1 file changed, 4 insertions(+), 5 deletions(-)

diff --git a/mm/mlock.c b/mm/mlock.c
index 25936680..7e6ad9c 100644
--- a/mm/mlock.c
+++ b/mm/mlock.c
@@ -684,14 +684,13 @@ out:
 SYSCALL_DEFINE1(mlockall, int, flags)
 {
 	unsigned long lock_limit;
-	int ret = -EINVAL;
+	int ret;
 
 	if (!flags || (flags & ~(MCL_CURRENT | MCL_FUTURE)))
-		goto out;
+		return -EINVAL;
 
-	ret = -EPERM;
 	if (!can_do_mlock())
-		goto out;
+		return -EPERM;
 
 	if (flags & MCL_CURRENT)
 		lru_add_drain_all();	/* flush pagevec */
@@ -708,7 +707,7 @@ SYSCALL_DEFINE1(mlockall, int, flags)
 	up_write(&current->mm->mmap_sem);
 	if (!ret && (flags & MCL_CURRENT))
 		mm_populate(0, TASK_SIZE);
-out:
+
 	return ret;
 }
 
-- 
2.1.4

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

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ