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-next>] [day] [month] [year] [list]
Message-Id: <20210421201639.1541945-1-linux@rasmusvillemoes.dk>
Date:   Wed, 21 Apr 2021 22:16:39 +0200
From:   Rasmus Villemoes <linux@...musvillemoes.dk>
To:     Dmitry Torokhov <dmitry.torokhov@...il.com>
Cc:     Rasmus Villemoes <linux@...musvillemoes.dk>,
        linux-input@...r.kernel.org, linux-kernel@...r.kernel.org
Subject: [PATCH] Input: atkbd - simplify atkbd_show_force_release()

We can just include the newline in the format string, and scnprintf()
guarantees nul-termination. These days, sysfs_emit() is
preferred in sysfs ->show methods, so switch to that.

Signed-off-by: Rasmus Villemoes <linux@...musvillemoes.dk>
---
 drivers/input/keyboard/atkbd.c | 9 ++-------
 1 file changed, 2 insertions(+), 7 deletions(-)

diff --git a/drivers/input/keyboard/atkbd.c b/drivers/input/keyboard/atkbd.c
index edc613efc158..b146a3ec631a 100644
--- a/drivers/input/keyboard/atkbd.c
+++ b/drivers/input/keyboard/atkbd.c
@@ -1492,13 +1492,8 @@ static ssize_t atkbd_set_extra(struct atkbd *atkbd, const char *buf, size_t coun
 
 static ssize_t atkbd_show_force_release(struct atkbd *atkbd, char *buf)
 {
-	size_t len = scnprintf(buf, PAGE_SIZE - 1, "%*pbl",
-			       ATKBD_KEYMAP_SIZE, atkbd->force_release_mask);
-
-	buf[len++] = '\n';
-	buf[len] = '\0';
-
-	return len;
+	return sysfs_emit(buf, "%*pbl\n",
+			  ATKBD_KEYMAP_SIZE, atkbd->force_release_mask);
 }
 
 static ssize_t atkbd_set_force_release(struct atkbd *atkbd,
-- 
2.29.2

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ