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: <20240715-rfkill_fix-v1-1-a9f2d56b4716@quicinc.com>
Date: Mon, 15 Jul 2024 21:39:19 +0800
From: Zijun Hu <zijun_hu@...oud.com>
To: Johannes Berg <johannes@...solutions.net>, 
 "David S. Miller" <davem@...emloft.net>, Eric Dumazet <edumazet@...gle.com>, 
 Jakub Kicinski <kuba@...nel.org>, Paolo Abeni <pabeni@...hat.com>
Cc: Zijun Hu <zijun_hu@...oud.com>, linux-wireless@...r.kernel.org, 
 linux-kernel@...r.kernel.org, netdev@...r.kernel.org, 
 Zijun Hu <quic_zijuhu@...cinc.com>
Subject: [PATCH] wifi: rfkill: Correct parameter type for
 rfkill_set_hw_state_reason()

From: Zijun Hu <quic_zijuhu@...cinc.com>

Change type of parameter @reason to enum rfkill_hard_block_reasons for
API rfkill_set_hw_state_reason() according to its comments.

Signed-off-by: Zijun Hu <quic_zijuhu@...cinc.com>
---
 include/linux/rfkill.h | 5 ++---
 net/rfkill/core.c      | 7 +------
 2 files changed, 3 insertions(+), 9 deletions(-)

diff --git a/include/linux/rfkill.h b/include/linux/rfkill.h
index 373003ace639..4f7558267541 100644
--- a/include/linux/rfkill.h
+++ b/include/linux/rfkill.h
@@ -147,7 +147,7 @@ void rfkill_destroy(struct rfkill *rfkill);
  * Prefer to use rfkill_set_hw_state if you don't need any special reason.
  */
 bool rfkill_set_hw_state_reason(struct rfkill *rfkill,
-				bool blocked, unsigned long reason);
+		bool blocked, enum rfkill_hard_block_reasons reason);
 /**
  * rfkill_set_hw_state - Set the internal rfkill hardware block state
  * @rfkill: pointer to the rfkill class to modify.
@@ -279,8 +279,7 @@ static inline void rfkill_destroy(struct rfkill *rfkill)
 }
 
 static inline bool rfkill_set_hw_state_reason(struct rfkill *rfkill,
-					      bool blocked,
-					      unsigned long reason)
+		bool blocked, enum rfkill_hard_block_reasons reason)
 {
 	return blocked;
 }
diff --git a/net/rfkill/core.c b/net/rfkill/core.c
index 7a5367628c05..f8ed6431b2f5 100644
--- a/net/rfkill/core.c
+++ b/net/rfkill/core.c
@@ -539,18 +539,13 @@ bool rfkill_get_global_sw_state(const enum rfkill_type type)
 #endif
 
 bool rfkill_set_hw_state_reason(struct rfkill *rfkill,
-				bool blocked, unsigned long reason)
+		bool blocked, enum rfkill_hard_block_reasons reason)
 {
 	unsigned long flags;
 	bool ret, prev;
 
 	BUG_ON(!rfkill);
 
-	if (WARN(reason & ~(RFKILL_HARD_BLOCK_SIGNAL |
-			    RFKILL_HARD_BLOCK_NOT_OWNER),
-		 "hw_state reason not supported: 0x%lx", reason))
-		return rfkill_blocked(rfkill);
-
 	spin_lock_irqsave(&rfkill->lock, flags);
 	prev = !!(rfkill->hard_block_reasons & reason);
 	if (blocked) {

---
base-commit: 338a93cf4a18c2036b567e9f613367f7a52f2511
change-id: 20240715-rfkill_fix-335afa2e88ca

Best regards,
-- 
Zijun Hu <quic_zijuhu@...cinc.com>


Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ