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: <20241002133418.7924-2-tudor.reda@gmail.com>
Date: Wed,  2 Oct 2024 16:34:19 +0300
From: Tudor Gheorghiu <tudor.reda@...il.com>
To: Andy Whitcroft <apw@...onical.com>,
	Joe Perches <joe@...ches.com>,
	Dwaipayan Ray <dwaipayanray1@...il.com>,
	Lukas Bulwahn <lukas.bulwahn@...il.com>
Cc: linux-kernel@...r.kernel.org,
	Nam Cao <namcao@...utronix.de>,
	Tudor Gheorghiu <tudor.reda@...il.com>
Subject: [PATCH] checkpatch: fix IIO_DEV_ATTR false positives

The NON_OCTAL_PERMISSIONS checkpatch error can trigger false positives
when searching for the "IIO_DEV_ATTR_[A-Z_]+" pattern. The script checks
for any matching macros and reports an error if the first argument is a
literal and is not in octal notation.

There are a few other macros that match this pattern, in which the first
argument is not a file permission, therefore they don't necessarily need
to be matched by this condition.

The macros are all defined in include/linux/iio/sysfs.h:

> #define IIO_DEV_ATTR_SAMP_FREQ(_mode, _show, _store)
> #define IIO_DEV_ATTR_SAMP_FREQ_AVAIL(_show)
> #define IIO_DEV_ATTR_INT_TIME_AVAIL(_show)
> #define IIO_DEV_ATTR_TEMP_RAW(_show)

The script is fixed by matching IIO_DEV_ATTR_SAMP_FREQ exclusively.

Discovered by running checkpatch on some staging iio drivers:
https://lore.kernel.org/linux-iio/20241001202430.15874-2-tudor.reda@gmail.com/

Potential checkpatch issue identified and patch suggested:
https://lore.kernel.org/linux-iio/20241001225426.wUBOFdMi@linutronix.de/

Signed-off-by: Tudor Gheorghiu <tudor.reda@...il.com>
Suggested-by: Nam Cao <namcao@...utronix.de>
---
 scripts/checkpatch.pl | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/scripts/checkpatch.pl b/scripts/checkpatch.pl
index 4427572b2477..2fb4549fede2 100755
--- a/scripts/checkpatch.pl
+++ b/scripts/checkpatch.pl
@@ -817,7 +817,7 @@ our @mode_permission_funcs = (
 	["debugfs_create_(?:file|u8|u16|u32|u64|x8|x16|x32|x64|size_t|atomic_t|bool|blob|regset32|u32_array)", 2],
 	["proc_create(?:_data|)", 2],
 	["(?:CLASS|DEVICE|SENSOR|SENSOR_DEVICE|IIO_DEVICE)_ATTR", 2],
-	["IIO_DEV_ATTR_[A-Z_]+", 1],
+	["IIO_DEV_ATTR_SAMP_FREQ", 1],
 	["SENSOR_(?:DEVICE_|)ATTR_2", 2],
 	["SENSOR_TEMPLATE(?:_2|)", 3],
 	["__ATTR", 2],
-- 
2.43.0


Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ