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: <20180925061855.19557-1-natechancellor@gmail.com>
Date:   Mon, 24 Sep 2018 23:18:55 -0700
From:   Nathan Chancellor <natechancellor@...il.com>
To:     Linus Walleij <linus.walleij@...aro.org>
Cc:     linux-gpio@...r.kernel.org, linux-kernel@...r.kernel.org,
        Nick Desaulniers <ndesaulniers@...gle.com>,
        Nathan Chancellor <natechancellor@...il.com>
Subject: [PATCH] pinctrl: generic: Avoid several implicit enum conversions

Clang warns when one enumerated type is implicitly converted to another,
which happens several times in the pinctrl drivers for a few reasons:

* The PCONFDUMP macro, which sets the param member in pin_config_item.
* The pinconf_generic_params structure, which is used by drivers to
  configure their bindings, which has a param member like pin_config_item.
* The pinconf_to_config_packed, which takes either the generic enum
  pin_config_param or a specialized one.

Drivers are allowed to extend this enumerated type because of the gap
betweem PIN_CONFIG_END and PIN_CONFIG_MAX. Make it clear to Clang that
this is allowed by changing param's type in all of these instances to
int so no conversion needs to happen.

Link: https://github.com/ClangBuiltLinux/linux/issues/138
Signed-off-by: Nathan Chancellor <natechancellor@...il.com>
---
 include/linux/pinctrl/pinconf-generic.h | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/include/linux/pinctrl/pinconf-generic.h b/include/linux/pinctrl/pinconf-generic.h
index 6c0680641108..13076ae7acfb 100644
--- a/include/linux/pinctrl/pinconf-generic.h
+++ b/include/linux/pinctrl/pinconf-generic.h
@@ -150,7 +150,7 @@ static inline u32 pinconf_to_config_argument(unsigned long config)
 	return (u32) ((config >> 8) & 0xffffffUL);
 }
 
-static inline unsigned long pinconf_to_config_packed(enum pin_config_param param,
+static inline unsigned long pinconf_to_config_packed(int param,
 						     u32 argument)
 {
 	return PIN_CONF_PACKED(param, argument);
@@ -164,7 +164,7 @@ static inline unsigned long pinconf_to_config_packed(enum pin_config_param param
 	}
 
 struct pin_config_item {
-	const enum pin_config_param param;
+	const int param;
 	const char * const display;
 	const char * const format;
 	bool has_arg;
@@ -180,7 +180,7 @@ struct pinctrl_map;
 
 struct pinconf_generic_params {
 	const char * const property;
-	enum pin_config_param param;
+	int param;
 	u32 default_value;
 };
 
-- 
2.19.0

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ