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] [day] [month] [year] [list]
Message-ID: <20200813005607.GA84958@8851f5375e5a>
Date:   Thu, 13 Aug 2020 08:56:07 +0800
From:   kernel test robot <lkp@...el.com>
To:     Denis Efremov <efremov@...ux.com>
Cc:     kbuild-all@...ts.01.org, linux-kernel@...r.kernel.org,
        Julia Lawall <Julia.Lawall@...6.fr>,
        Stefan Achatz <erazor_de@...rs.sourceforge.net>,
        Jiri Kosina <jikos@...nel.org>,
        Benjamin Tissoires <benjamin.tissoires@...hat.com>,
        linux-input@...r.kernel.org
Subject: [PATCH] coccinelle: api: fix device_attr_show.cocci warnings

From: kernel test robot <lkp@...el.com>

drivers/hid/hid-roccat-arvo.c:149:8-16: WARNING: use scnprintf or sprintf
drivers/hid/hid-roccat-arvo.c:95:8-16: WARNING: use scnprintf or sprintf
drivers/hid/hid-roccat-arvo.c:45:8-16: WARNING: use scnprintf or sprintf


 From Documentation/filesystems/sysfs.txt:
  show() must not use snprintf() when formatting the value to be
  returned to user space. If you can guarantee that an overflow
  will never happen you can use sprintf() otherwise you must use
  scnprintf().

Generated by: scripts/coccinelle/api/device_attr_show.cocci

Fixes: abfc19ff202d ("coccinelle: api: add device_attr_show script")
CC: Denis Efremov <efremov@...ux.com>
Signed-off-by: kernel test robot <lkp@...el.com>
---

tree:   https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git master
head:   7c2a69f610e64c8dec6a06a66e721f4ce1dd783a
commit: abfc19ff202d287742483e15fd478ddd6ada2187 coccinelle: api: add device_attr_show script

Please take the patch only if it's a positive warning. Thanks!

 hid-roccat-arvo.c |    6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

--- a/drivers/hid/hid-roccat-arvo.c
+++ b/drivers/hid/hid-roccat-arvo.c
@@ -42,7 +42,7 @@ static ssize_t arvo_sysfs_show_mode_key(
 	if (retval)
 		return retval;
 
-	return snprintf(buf, PAGE_SIZE, "%d\n", temp_buf.state);
+	return scnprintf(buf, PAGE_SIZE, "%d\n", temp_buf.state);
 }
 
 static ssize_t arvo_sysfs_set_mode_key(struct device *dev,
@@ -92,7 +92,7 @@ static ssize_t arvo_sysfs_show_key_mask(
 	if (retval)
 		return retval;
 
-	return snprintf(buf, PAGE_SIZE, "%d\n", temp_buf.key_mask);
+	return scnprintf(buf, PAGE_SIZE, "%d\n", temp_buf.key_mask);
 }
 
 static ssize_t arvo_sysfs_set_key_mask(struct device *dev,
@@ -146,7 +146,7 @@ static ssize_t arvo_sysfs_show_actual_pr
 	struct arvo_device *arvo =
 			hid_get_drvdata(dev_get_drvdata(dev->parent->parent));
 
-	return snprintf(buf, PAGE_SIZE, "%d\n", arvo->actual_profile);
+	return scnprintf(buf, PAGE_SIZE, "%d\n", arvo->actual_profile);
 }
 
 static ssize_t arvo_sysfs_set_actual_profile(struct device *dev,

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ