Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Kernel 6.7-6.12 build support and other fixes #275

Open
wants to merge 11 commits into
base: v5.3.9
Choose a base branch
from

Conversation

gglluukk
Copy link
Contributor

According to issue #273:

[ +0.000036] UBSAN: shift-out-of-bounds in /root/tmp/rtl8188eus/hal/phydm/phydm_phystatus.c:1751:67
[ +0.000041] shift exponent 63 is too large for 32-bit type 'int'

where at hal/phydm/phydm_phystatus.c:1750-1751 following code is found:

i = 63;
sta->rssi_stat.ofdm_pkt_cnt -= (u8)((sta->rssi_stat.packet_map >> i) & BIT(0));

trying to fix it

sta->rssi_stat.packet_map is to be split as follows:

sta is struct cmn_sta_info defined in include/cmn_info/rtw_sta_info.h:188

struct cmn_sta_info {
        u16     dm_ctrl;
        enum channel_width      bw_mode;        /*max bandwidth*/
        u8      mac_id;
        u8      mac_addr[6];
        u16     aid;
        enum rf_type mimo_type;         /*sta XTXR*/
        struct rssi_info        rssi_stat;
        struct ra_sta_info      ra_info;
        u16     tx_moving_average_tp;   /*tx average MBps*/
        u16     rx_moving_average_tp;   /*rx average MBps*/
        u8      stbc_en:2;              /*Driver : really use stbc!!*/
        u8      ldpc_en:2;
        enum wireless_set       support_wireless_set;
#ifdef CONFIG_BEAMFORMING
        struct bf_cmn_info      bf_info;
#endif
        u8      sm_ps:2;
        struct dtp_info dtp_stat;       /*Dynamic Tx power offset*/
        /*u8            pw2cca_over_TH_cnt;*/
        /*u8            total_pw2cca_cnt;*/
};

rssi_stat is struct rssi_info defined in include/cmn_info/rtw_sta_info.h:148

struct rssi_info {
        s8              rssi;   
        s8              rssi_cck;
        s8              rssi_ofdm;
        u8              packet_map;     
        u8              ofdm_pkt_cnt;
        u8              cck_pkt_cnt;
        u16             cck_sum_power;
        u8              is_send_rssi;
        u8              valid_bit;
        s16             rssi_acc;       /*accumulate RSSI for per packet MA sum*/
};      

packet_map is u8 (short unsigned int) with size of 8 bits that's why shift can't be more than 8. the logic of code is a shift up to last bit of packet_map and next bitwise AND BIT(0) that's why shift is to be equal to 7.

@gglluukk gglluukk mentioned this pull request Nov 11, 2023
@gglluukk gglluukk changed the title Shift-out-of-bounds fix and rtl8xxxu note in README Kernel 6.7 build support, shift-out-of-bounds fix and rtl8xxxu note in README Jan 23, 2024
@gglluukk gglluukk changed the title Kernel 6.7 build support, shift-out-of-bounds fix and rtl8xxxu note in README Kernel 6.7/6.8 build support, shift-out-of-bounds fix and rtl8xxxu note in README Mar 16, 2024
@gglluukk gglluukk changed the title Kernel 6.7/6.8 build support, shift-out-of-bounds fix and rtl8xxxu note in README Kernel 6.7/6.8/6.9 build support, shift-out-of-bounds fix and rtl8xxxu note in README May 14, 2024
@gglluukk gglluukk changed the title Kernel 6.7/6.8/6.9 build support, shift-out-of-bounds fix and rtl8xxxu note in README Kernel 6.7-6.10 build support, shift-out-of-bounds fix and rtl8xxxu note in README Aug 7, 2024
@gglluukk gglluukk changed the title Kernel 6.7-6.10 build support, shift-out-of-bounds fix and rtl8xxxu note in README Kernel 6.7-6.10 build support and other fixes Aug 31, 2024
@nix-julia
Copy link

@kimocoder could you please merge this?

@@ -417,7 +417,9 @@ u8 rtw_cfg80211_ch_switch_notify(_adapter *adapter, u8 ch, u8 bw, u8 offset, u8
if (ret != _SUCCESS)
goto exit;

#if (LINUX_VERSION_CODE >= KERNEL_VERSION(6, 3, 0))
#if (LINUX_VERSION_CODE >= KERNEL_VERSION(6, 9, 0))

This comment was marked as resolved.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yep, it's stated in topic:
Kernel 6.7-6.10 build support and other fixes

@gglluukk gglluukk changed the title Kernel 6.7-6.10 build support and other fixes Kernel 6.7-6.11 build support and other fixes Sep 17, 2024
@gglluukk gglluukk changed the title Kernel 6.7-6.11 build support and other fixes Kernel 6.7-6.12 build support and other fixes Nov 21, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants