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: <20250605221037.7872-7-shikemeng@huaweicloud.com>
Date: Fri,  6 Jun 2025 06:10:36 +0800
From: Kemeng Shi <shikemeng@...weicloud.com>
To: hughd@...gle.com,
	baolin.wang@...ux.alibaba.com,
	willy@...radead.org,
	akpm@...ux-foundation.org
Cc: linux-mm@...ck.org,
	linux-kernel@...r.kernel.org,
	linux-fsdevel@...r.kernel.org
Subject: [PATCH 6/7] mm: shmem: simplify error flow in thpsize_shmem_enabled_store()

Simplify error flow in thpsize_shmem_enabled_store().

Signed-off-by: Kemeng Shi <shikemeng@...weicloud.com>
---
 mm/shmem.c | 14 ++++++--------
 1 file changed, 6 insertions(+), 8 deletions(-)

diff --git a/mm/shmem.c b/mm/shmem.c
index e3e05bbb6db2..c6ea45d542d2 100644
--- a/mm/shmem.c
+++ b/mm/shmem.c
@@ -5601,7 +5601,7 @@ static ssize_t thpsize_shmem_enabled_store(struct kobject *kobj,
 					   const char *buf, size_t count)
 {
 	int order = to_thpsize(kobj)->order;
-	ssize_t ret = count;
+	int err;
 
 	if (sysfs_streq(buf, "always")) {
 		spin_lock(&huge_shmem_orders_lock);
@@ -5644,16 +5644,14 @@ static ssize_t thpsize_shmem_enabled_store(struct kobject *kobj,
 		clear_bit(order, &huge_shmem_orders_madvise);
 		spin_unlock(&huge_shmem_orders_lock);
 	} else {
-		ret = -EINVAL;
+		return -EINVAL;
 	}
 
-	if (ret > 0) {
-		int err = start_stop_khugepaged();
+	err = start_stop_khugepaged();
+	if (err)
+		return err;
 
-		if (err)
-			ret = err;
-	}
-	return ret;
+	return count;
 }
 
 struct kobj_attribute thpsize_shmem_enabled_attr =
-- 
2.30.0


Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ