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>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <fec80877-6556-876c-72ca-f6ccb85e0700@users.sourceforge.net>
Date:   Wed, 18 Jan 2017 14:50:05 +0100
From:   SF Markus Elfring <elfring@...rs.sourceforge.net>
To:     Haavard Skinnemoen <hskinnemoen@...il.com>,
        Hans-Christian Egtvedt <egtvedt@...fundet.no>
Cc:     LKML <linux-kernel@...r.kernel.org>,
        kernel-janitors@...r.kernel.org
Subject: [PATCH 3/3] AVR32: Return an error code only as a constant in
 sys_cacheflush()

From: Markus Elfring <elfring@...rs.sourceforge.net>
Date: Wed, 18 Jan 2017 14:30:11 +0100

* Return an error code without storing it in an intermediate variable.

* Delete the local variable "ret" which became unnecessary with
  this refactoring.

Signed-off-by: Markus Elfring <elfring@...rs.sourceforge.net>
---
 arch/avr32/mm/cache.c | 21 +++++----------------
 1 file changed, 5 insertions(+), 16 deletions(-)

diff --git a/arch/avr32/mm/cache.c b/arch/avr32/mm/cache.c
index 85d635cd7b28..c893e5944390 100644
--- a/arch/avr32/mm/cache.c
+++ b/arch/avr32/mm/cache.c
@@ -126,30 +126,19 @@ void flush_icache_page(struct vm_area_struct *vma, struct page *page)
 
 asmlinkage int sys_cacheflush(int operation, void __user *addr, size_t len)
 {
-	int ret;
-
-	if (len > CACHEFLUSH_MAX_LEN) {
-		ret = -EPERM;
-		if (!capable(CAP_SYS_ADMIN))
-			goto out;
-	}
-
-	ret = -EFAULT;
+	if (len > CACHEFLUSH_MAX_LEN && !capable(CAP_SYS_ADMIN))
+		return -EPERM;
 	if (!access_ok(VERIFY_WRITE, addr, len))
-		goto out;
+		return -EFAULT;
 
 	switch (operation) {
 	case CACHE_IFLUSH:
 		flush_icache_range((unsigned long)addr,
 				   (unsigned long)addr + len);
-		ret = 0;
-		break;
+		return 0;
 	default:
-		ret = -EINVAL;
+		return -EINVAL;
 	}
-
-out:
-	return ret;
 }
 
 void copy_to_user_page(struct vm_area_struct *vma, struct page *page,
-- 
2.11.0

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ