Re: [PATCH 1/1] rtlwifi: rtl8723be: avoid undefined behavior

From: Larry Finger
Date: Wed May 18 2016 - 08:12:21 EST


On 05/17/2016 05:46 PM, Heinrich Schuchardt wrote:
Do not return undefined value for transmission power
if the rate is invalid.

Signed-off-by: Heinrich Schuchardt <xypron.glpk@xxxxxx>
---
drivers/net/wireless/realtek/rtlwifi/rtl8723be/phy.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/net/wireless/realtek/rtlwifi/rtl8723be/phy.c b/drivers/net/wireless/realtek/rtlwifi/rtl8723be/phy.c
index 445f681..c5ca9df 100644
--- a/drivers/net/wireless/realtek/rtlwifi/rtl8723be/phy.c
+++ b/drivers/net/wireless/realtek/rtlwifi/rtl8723be/phy.c
@@ -1019,7 +1019,7 @@ static u8 _rtl8723be_get_txpower_index(struct ieee80211_hw *hw, u8 path,
struct rtl_priv *rtlpriv = rtl_priv(hw);
struct rtl_efuse *rtlefuse = rtl_efuse(rtl_priv(hw));
u8 index = (channel - 1);
- u8 txpower;
+ u8 txpower = 0;
u8 power_diff_byrate = 0;

if (channel > 14 || channel < 1) {

Did gcc give you a warning about this variable not being initialized? Mine does not. In any case, this change is appropriate.

Acked-by: Larry Finger <Larry.Finger@xxxxxxxxxxxx>

Thanks,

Larry