[openwrt/openwrt] mac80211: fix use of local variable

LEDE Commits lede-commits at lists.infradead.org
Tue Jun 30 16:14:44 EDT 2020


adrian pushed a commit to openwrt/openwrt.git, branch openwrt-19.07:
https://git.openwrt.org/73fecd36bfd2b9f92a2a20f38bdb73b4433dec3e

commit 73fecd36bfd2b9f92a2a20f38bdb73b4433dec3e
Author: Leon M. George <leon at georgemail.eu>
AuthorDate: Thu Apr 30 10:26:36 2020 +0200

    mac80211: fix use of local variable
    
    mac80211_get_addr is called from mac80211_generate_mac, where the local variable
    initialisation id="${macidx:-0}" suggests that macidx is not always defined.
    Probably, idx was supposed to be used instead of $(($macidx + 1)).
    
    Fixes: 4d99db168cf7 ("mac80211: try to get interface addresses from wiphy sysfs 'addresses' if no mask is set")
    
    Signed-off-by: Leon M. George <leon at georgemail.eu>
    (cherry picked from commit 8f95220bcb554b1b668114e5264ebce4028c5f93)
---
 package/kernel/mac80211/files/lib/netifd/wireless/mac80211.sh | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/package/kernel/mac80211/files/lib/netifd/wireless/mac80211.sh b/package/kernel/mac80211/files/lib/netifd/wireless/mac80211.sh
index 634aadcee9..36aebbb2cc 100644
--- a/package/kernel/mac80211/files/lib/netifd/wireless/mac80211.sh
+++ b/package/kernel/mac80211/files/lib/netifd/wireless/mac80211.sh
@@ -352,7 +352,7 @@ mac80211_get_addr() {
 	local phy="$1"
 	local idx="$(($2 + 1))"
 
-	head -n $(($macidx + 1)) /sys/class/ieee80211/${phy}/addresses | tail -n1
+	head -n $idx /sys/class/ieee80211/${phy}/addresses | tail -n1
 }
 
 mac80211_generate_mac() {



More information about the lede-commits mailing list