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]
Message-Id: <20250814142306.282211-1-rongqianfeng@vivo.com>
Date: Thu, 14 Aug 2025 22:23:05 +0800
From: Qianfeng Rong <rongqianfeng@...o.com>
To: Andreas Gruenbacher <agruenba@...hat.com>,
	gfs2@...ts.linux.dev,
	linux-kernel@...r.kernel.org
Cc: Qianfeng Rong <rongqianfeng@...o.com>
Subject: [PATCH] gfs2: Use min_t() to improve code

Use min_t() to reduce the code in gfs2_page_mkwrite() and improve its
readability.

Signed-off-by: Qianfeng Rong <rongqianfeng@...o.com>
---
 fs/gfs2/file.c | 5 +----
 1 file changed, 1 insertion(+), 4 deletions(-)

diff --git a/fs/gfs2/file.c b/fs/gfs2/file.c
index bc67fa058c84..b54746299c5a 100644
--- a/fs/gfs2/file.c
+++ b/fs/gfs2/file.c
@@ -448,10 +448,7 @@ static vm_fault_t gfs2_page_mkwrite(struct vm_fault *vmf)
 	file_update_time(vmf->vma->vm_file);
 
 	/* folio is wholly or partially inside EOF */
-	if (size - pos < folio_size(folio))
-		length = size - pos;
-	else
-		length = folio_size(folio);
+	length = min_t(size_t, size - pos, folio_size(folio));
 
 	gfs2_size_hint(vmf->vma->vm_file, pos, length);
 
-- 
2.34.1


Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ