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: <f69334a0-ccdb-4caf-b5b4-177cbf0ed1d7@web.de>
Date: Mon, 15 Jul 2024 12:52:07 +0200
From: Markus Elfring <Markus.Elfring@....de>
To: gfs2@...ts.linux.dev, kernel-janitors@...r.kernel.org,
 Alexander Aring <aahringo@...hat.com>,
 Christophe Jaillet <christophe.jaillet@...adoo.fr>,
 David Teigland <teigland@...hat.com>
Cc: LKML <linux-kernel@...r.kernel.org>
Subject: [PATCH] dlm: Simplify character output in three functions

From: Markus Elfring <elfring@...rs.sourceforge.net>
Date: Mon, 15 Jul 2024 12:36:44 +0200

Single characters should be put into a sequence.
Thus use the corresponding function “seq_putc” for three selected calls.

This issue was transformed by using the Coccinelle software.

Suggested-by: Christophe Jaillet <christophe.jaillet@...adoo.fr>
Signed-off-by: Markus Elfring <elfring@...rs.sourceforge.net>
---
 fs/dlm/debug_fs.c | 12 ++++--------
 1 file changed, 4 insertions(+), 8 deletions(-)

diff --git a/fs/dlm/debug_fs.c b/fs/dlm/debug_fs.c
index 7112958c2e5b..0d21007930ed 100644
--- a/fs/dlm/debug_fs.c
+++ b/fs/dlm/debug_fs.c
@@ -81,12 +81,8 @@ static void print_format1(struct dlm_rsb *res, struct seq_file *s)

 	seq_printf(s, "\nResource %p Name (len=%d) \"", res, res->res_length);

-	for (i = 0; i < res->res_length; i++) {
-		if (isprint(res->res_name[i]))
-			seq_printf(s, "%c", res->res_name[i]);
-		else
-			seq_printf(s, "%c", '.');
-	}
+	for (i = 0; i < res->res_length; i++)
+		seq_putc(s, (isprint(res->res_name[i]) ? res->res_name[i] : '.'));

 	if (res->res_nodeid > 0)
 		seq_printf(s, "\"\nLocal Copy, Master is node %d\n",
@@ -284,7 +280,7 @@ static void print_format3(struct dlm_rsb *r, struct seq_file *s)

 	for (i = 0; i < r->res_length; i++) {
 		if (print_name)
-			seq_printf(s, "%c", r->res_name[i]);
+			seq_putc(s, r->res_name[i]);
 		else
 			seq_printf(s, " %02x", (unsigned char)r->res_name[i]);
 	}
@@ -358,7 +354,7 @@ static void print_format4(struct dlm_rsb *r, struct seq_file *s)

 	for (i = 0; i < r->res_length; i++) {
 		if (print_name)
-			seq_printf(s, "%c", r->res_name[i]);
+			seq_putc(s, r->res_name[i]);
 		else
 			seq_printf(s, " %02x", (unsigned char)r->res_name[i]);
 	}
--
2.45.2


Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ