Thread (12 messages) 12 messages, 2 authors, 2024-06-12

Re: [PATCH v1 2/2] net: rfkill: Fix a logic error within rfkill_set_hw_state_reason()

From: quic_zijuhu <hidden>
Date: 2024-06-12 10:36:13
Also in: linux-wireless

On 6/12/2024 6:18 PM, Johannes Berg wrote:
On Fri, 2024-06-07 at 22:40 +0800, Zijun Hu wrote:
quoted
Kernel API rfkill_set_hw_state_reason() wrongly gets previous block state
by using its parameter @reason as reason mask.

Fixed by using @reason_mask as reason mask.
Actually, this *introduces* a bug. I'll leave it to you to figure out
what that is, I'm not convinced that you're actually doing *anything*
useful here.
i feels that current logic is weird and it is very difficult to
understand when i read rfkill code.

i think it deserves a comments for current logic if it is right.

current logic was introduced by below code applet of the commit
Commit: 14486c82612a ("rfkill: add a reason to the HW rfkill state")
-       prev = !!(rfkill->state & RFKILL_BLOCK_HW);
-       if (blocked)
+       prev = !!(rfkill->hard_block_reasons & reason);
+       if (blocked) {
                rfkill->state |= RFKILL_BLOCK_HW;

i maybe need to find history to try to understand current logic if it is
right.
johannes
  
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help