staging: rtl8723bs: Fix return type for implementation of ndo_start_xmit
PATCH v3 1/1 staging: rtl8723bs: Fix return type for implementation of ndo_start_xmit
CFI (Control Flow Integrity) is a safety feature allowing the system to detect and react should a potential control flow hijacking occurs. In particular, the Forward-Edge CFI protects indirect function calls by ensuring the prototype of function that is actually called matches the definition of the function hook.
Since Linux now supports CFI, it will be a good idea to fix mismatched return type for implementation of hooks. Otherwise this would get cought out by CFI and cause a panic.
As returns from _rtw_xmit_entry() would always be 0, remove unneeded variable ret and use enums from netdev_tx_t as return value instead. Then change return type to netdev_tx_t.
---
v3:
Provide detail on CFI.
v2:
Fix truncated subject.
--- drivers/staging/rtl8723bs/include/xmit_osdep.h | 2 +- drivers/staging/rtl8723bs/os_dep/xmit_linux.c | 8 +++----- 2 files changed, 4 insertions(+), 6 deletions(-)
drivers/staging/rtl8723bs/include/xmit_osdep.h +1 -1
@@ -26,7 +26,7 @@ struct xmit_frame;struct xmit_buf ;extern int _rtw_xmit_entry (struct sk_buff *pkt,struct net_device *pnetdev); -extern int rtw_xmit_entry (struct sk_buff *pkt,struct net_device *pnetdev); +extern netdev_tx_t rtw_xmit_entry (struct sk_buff *pkt,struct net_device *pnetdev);void rtw_os_xmit_schedule (struct adapter *padapter);
drivers/staging/rtl8723bs/os_dep/xmit_linux.c +3 -5
@@ -220,12 +220,10 @@ int _rtw_xmit_entry(struct sk_buff *pkt, struct net_device *pnetdev)return 0 ; } -int rtw_xmit_entry (struct sk_buff *pkt,struct net_device *pnetdev) +netdev_tx_t rtw_xmit_entry (struct sk_buff *pkt,struct net_device *pnetdev) { -int ret =0 ; -if (pkt) - ret =_rtw_xmit_entry (pkt, pnetdev); +_rtw_xmit_entry (pkt, pnetdev); -return ret; +return NETDEV_TX_OK ; }
Signature · 1 line
2.17.1
Greg KH
maintainerQuoted 6 lines · GUO Zihua
CFI (Control Flow Integrity) is a safety feature allowing the system to detect and react should a potential control flow hijacking occurs. In particular, the Forward-Edge CFI protects indirect function calls by ensuring the prototype of function that is actually called matches the definition of the function hook.
Quoted 7 lines
Since Linux now supports CFI, it will be a good idea to fix mismatched return type for implementation of hooks. Otherwise this would get cought out by CFI and cause a panic.
As returns from
_rtw_xmit_entry()would always be 0, remove unneeded variable ret and use enums fromnetdev_tx_tas return value instead. Then change return type tonetdev_tx_t.
If _rtw_xmit_entry() can never fail, then it needs to not have a return value at all, and that needs to also be fixed. Can you make this a patch series that does the return type change for _rtw_xmit_entry() first, and then this change on top of that one.
thanks,
greg k-h
Quoted 20 lines · Greg KH
Quoted 6 lines · GUO Zihua
CFI (Control Flow Integrity) is a safety feature allowing the system to detect and react should a potential control flow hijacking occurs. In particular, the Forward-Edge CFI protects indirect function calls by ensuring the prototype of function that is actually called matches the definition of the function hook.
Quoted 7 lines
Since Linux now supports CFI, it will be a good idea to fix mismatched return type for implementation of hooks. Otherwise this would get cought out by CFI and cause a panic.
As returns from
_rtw_xmit_entry()would always be 0, remove unneeded variable ret and use enums fromnetdev_tx_tas return value instead. Then change return type tonetdev_tx_t.If
_rtw_xmit_entry()can never fail, then it needs to not have a return value at all, and that needs to also be fixed. Can you make this a patch series that does the return type change for_rtw_xmit_entry()first, and then this change on top of that one.
Quoted 4 lines
thanks,
greg k-h
.
Sure Greg
Signature · 2 lines
Best GUO Zihua