Search Linux Wireless

[PATCH] mwifiex: protect against divide by zero in mwifiex_set_ibss_params

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



In function mwifiex_set_ibss_params, the variable index may remain
zero if it is never altered inside the loop, leading to a potential
divide by zero problem.

Signed-off-by: Yiyuan GUO <yguoaz@xxxxxxxxxx>
---
 drivers/net/wireless/marvell/mwifiex/cfg80211.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/net/wireless/marvell/mwifiex/cfg80211.c b/drivers/net/wireless/marvell/mwifiex/cfg80211.c
index 0961f4a5e..afcdebdcf 100644
--- a/drivers/net/wireless/marvell/mwifiex/cfg80211.c
+++ b/drivers/net/wireless/marvell/mwifiex/cfg80211.c
@@ -2450,7 +2450,7 @@ static int mwifiex_set_ibss_params(struct mwifiex_private *priv,
 				config_bands = BAND_B;
 			} else {
 				config_bands = BAND_G;
-				if (params->basic_rates % index)
+				if (index && (params->basic_rates % index))
 					config_bands |= BAND_B;
 			}
 		}
-- 
2.25.1




[Index of Archives]     [Linux Host AP]     [ATH6KL]     [Linux Wireless Personal Area Network]     [Linux Bluetooth]     [Wireless Regulations]     [Linux Netdev]     [Kernel Newbies]     [Linux Kernel]     [IDE]     [Git]     [Netfilter]     [Bugtraq]     [Yosemite Hiking]     [MIPS Linux]     [ARM Linux]     [Linux RAID]

  Powered by Linux