staging: rtl8723bs: modify struct field to use standard bool type
PATCH 1/1 staging: rtl8723bs: modify struct field to use standard bool type
The struct field uses the uint values 0 and 1 to represent false and true values respectively.
Convert cases to use the bool type instead to conform to Linux coding styles and ensure consistency.
reported by Coccinelle:
--- drivers/staging/rtl8723bs/core/rtw_ap.c | 2 +- drivers/staging/rtl8723bs/include/sta_info.h | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-)
drivers/staging/rtl8723bs/core/rtw_ap.c +1 -1
@@ -389,7 +389,7 @@ void update_bmc_sta(struct adapter *padapter) psta->qos_option =0 ; psta->htpriv.ht_option = false; - psta->ieee8021x_blocked =0 ; + psta->ieee8021x_blocked = false;memset ((void *)&psta->sta_stats,0 ,sizeof (struct stainfo_stats ));
drivers/staging/rtl8723bs/include/sta_info.h +1 -1
@@ -86,7 +86,7 @@ struct sta_info {uint qos_option;u8 hwaddr[ETH_ALEN ]; -uint ieee8021x_blocked;/* 0: allowed, 1:blocked */ +bool ieee8021x_blocked;uint dot118021XPrivacy;/* aes, tkip... */ union Keytype dot11tkiptxmickey;union Keytype dot11tkiprxmickey;
Signature · 1 line
2.34.1
Quoted 5 lines · Abraham Samuel Adekunle
The struct field uses the uint values 0 and 1 to represent false and true values respectively.
Convert cases to use the bool type instead to conform to Linux coding styles and ensure consistency.
This is vague. Ensure consistency with what? You can point out that true or false was already being used elsewhere in the code.
Quoted 27 lines
reported by Coccinelle:
Signed-off-by Abraham Samuel Adekunle <[email protected]>--- drivers/staging/rtl8723bs/core/rtw_ap.c | 2 +- drivers/staging/rtl8723bs/include/sta_info.h | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-)drivers/staging/rtl8723bs/core/rtw_ap.c +1
-1@@ -389,7 +389,7 @@ void update_bmc_sta(struct adapter *padapter) psta->qos_option =0 ; psta->htpriv.ht_option = false; - psta->ieee8021x_blocked =0 ; + psta->ieee8021x_blocked = false;memset ((void *)&psta->sta_stats,0 ,sizeof (struct stainfo_stats ));drivers/staging/rtl8723bs/include/sta_info.h +0
-0
drivers/staging/rtl8723bs/include/sta_info.h struct sta_info { · line 89
Quoted 5 lines
drivers/staging/rtl8723bs/include/sta_info.h +1
-1@@ -86,7 +86,7 @@ struct sta_info {uint qos_option;u8 hwaddr[ETH_ALEN ]; -uint ieee8021x_blocked;/* 0: allowed, 1:blocked */ +bool ieee8021x_blocked;
This declaration doesn't have the same alignment as the others.
You should also check whether this is a structure that is read from the hardware. In that case, it would be a concern if the bool field does not have the same size as the uint one.
julia
Quoted 7 lines
drivers/staging/rtl8723bs/include/sta_info.h +0
-1uint dot118021XPrivacy;/* aes, tkip... */ union Keytype dot11tkiptxmickey;union Keytype dot11tkiprxmickey; --2.34.1
Quoted 5 lines · Julia Lawall
On Wed, 2 Apr 2025, Abraham Samuel Adekunle wrote:
Quoted 8 lines
Quoted 5 lines
The struct field uses the uint values 0 and 1 to represent false and true values respectively.
Convert cases to use the bool type instead to conform to Linux coding styles and ensure consistency.
This is vague. Ensure consistency with what? You can point out that true or false was already being used elsewhere in the code.
Okay Noted.
Quoted 36 lines
Quoted 28 lines
reported by Coccinelle:
Signed-off-by Abraham Samuel Adekunle <[email protected]>--- drivers/staging/rtl8723bs/core/rtw_ap.c | 2 +- drivers/staging/rtl8723bs/include/sta_info.h | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-)drivers/staging/rtl8723bs/core/rtw_ap.c +1
-1@@ -389,7 +389,7 @@ void update_bmc_sta(struct adapter *padapter) psta->qos_option =0 ; psta->htpriv.ht_option = false; - psta->ieee8021x_blocked =0 ; + psta->ieee8021x_blocked = false;memset ((void *)&psta->sta_stats,0 ,sizeof (struct stainfo_stats ));drivers/staging/rtl8723bs/include/sta_info.h +0
-0drivers/staging/rtl8723bs/include/sta_info.h struct sta_info { · line 89
Quoted 5 lines
drivers/staging/rtl8723bs/include/sta_info.h +1
-1@@ -86,7 +86,7 @@ struct sta_info {uint qos_option;u8 hwaddr[ETH_ALEN ]; -uint ieee8021x_blocked;/* 0: allowed, 1:blocked */ +bool ieee8021x_blocked;This declaration doesn't have the same alignment as the others.
Quoted 5 lines
You should also check whether this is a structure that is read from the hardware. In that case, it would be a concern if the bool field does not have the same size as the uint one.
julia
Thank you very much. I will confirm and effect the changes
Adekunle
Quoted 44 lines · Julia Lawall
Quoted 5 lines · Abraham Samuel Adekunle
The struct field uses the uint values 0 and 1 to represent false and true values respectively.
Convert cases to use the bool type instead to conform to Linux coding styles and ensure consistency.
This is vague. Ensure consistency with what? You can point out that true or false was already being used elsewhere in the code.
Quoted 30 lines
reported by Coccinelle:
Signed-off-by Abraham Samuel Adekunle <[email protected]>--- drivers/staging/rtl8723bs/core/rtw_ap.c | 2 +- drivers/staging/rtl8723bs/include/sta_info.h | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-)drivers/staging/rtl8723bs/core/rtw_ap.c +1
-1@@ -389,7 +389,7 @@ void update_bmc_sta(struct adapter *padapter) psta->qos_option =0 ; psta->htpriv.ht_option = false; - psta->ieee8021x_blocked =0 ; + psta->ieee8021x_blocked = false;memset ((void *)&psta->sta_stats,0 ,sizeof (struct stainfo_stats ));drivers/staging/rtl8723bs/include/sta_info.h +0
-0@@ -86,7 +86,7 @@ struct sta_info {uint qos_option;u8 hwaddr[ETH_ALEN ];
Quoted 6 lines
drivers/staging/rtl8723bs/include/sta_info.h struct sta_info { · line 89
Quoted 2 lines
drivers/staging/rtl8723bs/include/sta_info.h +1
-1-uint ieee8021x_blocked;/* 0: allowed, 1:blocked */ +bool ieee8021x_blocked;You should also check whether this is a structure that is read from the hardware. In that case, it would be a concern if the bool field does not have the same size as the uint one.
Hello Julia
So following the conversation here,
https://lore.kernel.org/outreachy/[email protected]/T/#u
I was able to compare the assembly code of the file before and after my patch and this were my findings
Original assembly code for
# drivers/staging/rtl8723bs/core/rtw_ap.c:392 psta->ieee8021x_blocked = 0;
movl $0, 436(%r12) #, psta->ieee8021x_blocked
Assembly Code After Patch
# drivers/staging/rtl8723bs/core/rtw_ap.c:392psta->ieee8021x_blocked = false;
movb $0, 434(%r12) #, psta->ieee8021x_blocked
Adekunle
Greg Kroah-Hartman
maintainerQuoted 57 lines · Samuel Abraham
Quoted 44 lines · Julia Lawall
Quoted 5 lines · Abraham Samuel Adekunle
The struct field uses the uint values 0 and 1 to represent false and true values respectively.
Convert cases to use the bool type instead to conform to Linux coding styles and ensure consistency.
This is vague. Ensure consistency with what? You can point out that true or false was already being used elsewhere in the code.
Quoted 30 lines
reported by Coccinelle:
Signed-off-by Abraham Samuel Adekunle <[email protected]>--- drivers/staging/rtl8723bs/core/rtw_ap.c | 2 +- drivers/staging/rtl8723bs/include/sta_info.h | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-)drivers/staging/rtl8723bs/core/rtw_ap.c +1
-1@@ -389,7 +389,7 @@ void update_bmc_sta(struct adapter *padapter) psta->qos_option =0 ; psta->htpriv.ht_option = false; - psta->ieee8021x_blocked =0 ; + psta->ieee8021x_blocked = false;memset ((void *)&psta->sta_stats,0 ,sizeof (struct stainfo_stats ));drivers/staging/rtl8723bs/include/sta_info.h +0
-0@@ -86,7 +86,7 @@ struct sta_info {uint qos_option;u8 hwaddr[ETH_ALEN ];Quoted 6 lines
drivers/staging/rtl8723bs/include/sta_info.h struct sta_info { · line 89
Quoted 2 lines
drivers/staging/rtl8723bs/include/sta_info.h +1
-1-uint ieee8021x_blocked;/* 0: allowed, 1:blocked */ +bool ieee8021x_blocked;You should also check whether this is a structure that is read from the hardware. In that case, it would be a concern if the bool field does not have the same size as the uint one.
Hello Julia
So following the conversation here,
https://lore.kernel.org/outreachy/[email protected]/T/#u
I was able to compare the assembly code of the file before and after my patch and this were my findings
Quoted 8 lines
Original assembly code for
#drivers/staging/rtl8723bs/core/rtw_ap.c:392psta->ieee8021x_blocked= 0;
movl $0, 436(%r12) #,psta->ieee8021x_blockedAssembly Code After Patch
#drivers/staging/rtl8723bs/core/rtw_ap.c:392psta->ieee8021x_blocked= false;
movb $0, 434(%r12) #,psta->ieee8021x_blocked
So the structure size changed? That's not good at all, and is what I was worried about :(
Also, the tool 'pahole' might help out here to verify what exactly changed, if you want to dig in further here.
thanks,
greg k-h
Quoted 24 lines · Greg Kroah-Hartman
Quoted 24 lines
Quoted 8 lines
Quoted 8 lines
drivers/staging/rtl8723bs/include/sta_info.h +0
-0@@ -86,7 +86,7 @@ struct sta_info {uint qos_option;u8 hwaddr[ETH_ALEN ];Quoted 6 lines
drivers/staging/rtl8723bs/include/sta_info.h struct sta_info { · line 89
Quoted 2 lines
drivers/staging/rtl8723bs/include/sta_info.h +1
-1-uint ieee8021x_blocked;/* 0: allowed, 1:blocked */ +bool ieee8021x_blocked;You should also check whether this is a structure that is read from the hardware. In that case, it would be a concern if the bool field does not have the same size as the uint one.
Hello Julia
So following the conversation here,
https://lore.kernel.org/outreachy/[email protected]/T/#u
I was able to compare the assembly code of the file before and after my patch and this were my findingsOriginal assembly code for
#drivers/staging/rtl8723bs/core/rtw_ap.c:392psta->ieee8021x_blocked= 0;
movl $0, 436(%r12) #,psta->ieee8021x_blocked
Quoted 8 lines
Quoted 4 lines
Assembly Code After Patch
#drivers/staging/rtl8723bs/core/rtw_ap.c:392psta->ieee8021x_blocked= false;
movb $0, 434(%r12) #,psta->ieee8021x_blockedSo the structure size changed? That's not good at all, and is what I was worried about :(
You had complained about a different struct. struct rx_pkt_attrib. It's fine to modify this one.
regards,
dan carpenter
Greg Kroah-Hartman
maintainerQuoted 30 lines · Dan Carpenter
Quoted 29 lines · Greg Kroah-Hartman
Quoted 28 lines
Quoted 8 lines
Quoted 8 lines
drivers/staging/rtl8723bs/include/sta_info.h +0
-0@@ -86,7 +86,7 @@ struct sta_info {uint qos_option;u8 hwaddr[ETH_ALEN ];Quoted 6 lines
drivers/staging/rtl8723bs/include/sta_info.h struct sta_info { · line 89
Quoted 2 lines
drivers/staging/rtl8723bs/include/sta_info.h +1
-1-uint ieee8021x_blocked;/* 0: allowed, 1:blocked */ +bool ieee8021x_blocked;You should also check whether this is a structure that is read from the hardware. In that case, it would be a concern if the bool field does not have the same size as the uint one.
Hello Julia
So following the conversation here,
https://lore.kernel.org/outreachy/[email protected]/T/#u
I was able to compare the assembly code of the file before and after my patch and this were my findingsOriginal assembly code for
#drivers/staging/rtl8723bs/core/rtw_ap.c:392psta->ieee8021x_blocked= 0;
movl $0, 436(%r12) #,psta->ieee8021x_blockedAssembly Code After Patch
#drivers/staging/rtl8723bs/core/rtw_ap.c:392psta->ieee8021x_blocked= false;
movb $0, 434(%r12) #,psta->ieee8021x_blocked
Quoted 6 lines
Quoted 3 lines
So the structure size changed? That's not good at all, and is what I was worried about :(
You had complained about a different struct. struct
rx_pkt_attrib. It's fine to modify this one.
Argh, sorry, too many different threads right now, my fault...