o wl3501: kill one magic number, introducing WL3501_ESSID_MAX_LEN

parent cf3c4d88
......@@ -100,6 +100,8 @@ enum wl3501_status {
#define WL3501_FREQ_DOMAIN_FRANCE 0x32 /* Channel 10 to 13 */
#define WL3501_FREQ_DOMAIN_MKK 0x40 /* Channel 14 */
#define WL3501_ESSID_MAX_LEN (IW_ESSID_MAX_SIZE + 2)
struct wl3501_tx_hdr {
u16 tx_cnt;
unsigned char sync[16];
......@@ -146,7 +148,7 @@ struct wl3501_start_req {
u16 dtim_period;
u16 probe_delay;
u16 cap_info;
unsigned char ssid[34];
unsigned char ssid[WL3501_ESSID_MAX_LEN];
unsigned char bss_basic_rate_set[10];
unsigned char operational_rate_set[10];
unsigned char cf_pset[8];
......@@ -219,7 +221,7 @@ struct wl3501_join_req {
u16 cap_info;
unsigned char bss_type;
unsigned char bssid[ETH_ALEN];
unsigned char ssid[34];
unsigned char ssid[WL3501_ESSID_MAX_LEN];
unsigned char phy_pset[3];
unsigned char cf_pset[8];
unsigned char ibss_pset[4];
......@@ -242,7 +244,7 @@ struct wl3501_scan_req {
u16 max_chan_time;
unsigned char chan_list[14];
unsigned char bssid[ETH_ALEN];
unsigned char ssid[34];
unsigned char ssid[WL3501_ESSID_MAX_LEN];
enum wl3501_scan_type scan_type;
};
......@@ -258,7 +260,7 @@ struct wl3501_scan_confirm {
u16 cap_info;
unsigned char bss_type;
unsigned char bssid[ETH_ALEN];
unsigned char ssid[34];
unsigned char ssid[WL3501_ESSID_MAX_LEN];
unsigned char phy_pset[3];
unsigned char cf_pset[8];
unsigned char ibss_pset[4];
......@@ -422,11 +424,11 @@ struct wl3501_card {
u16 esbq_confirm_end;
u16 esbq_confirm;
u8 llc_type;
u8 essid[34];
u8 essid[WL3501_ESSID_MAX_LEN];
struct wl3501_mac_addr bssid;
int ether_type;
int net_type;
u8 keep_essid[34];
u8 keep_essid[WL3501_ESSID_MAX_LEN];
unsigned char nick[32];
u8 chan;
u8 def_chan;
......@@ -465,8 +467,8 @@ struct wl3501_ioctl_parm {
u8 def_chan;
u8 chan;
enum wl3501_net_type net_type;
u8 essid[34];
u8 keep_essid[34];
u8 essid[WL3501_ESSID_MAX_LEN];
u8 keep_essid[WL3501_ESSID_MAX_LEN];
u8 version[2];
u8 freq_domain;
};
......
......@@ -739,8 +739,9 @@ static int wl3501_mgmt_start(struct wl3501_card *this)
signal.next_blk = 0;
signal.sig_id = WL3501_SIG_START_REQ;
memcpy((char *)signal.ssid, (char *)this->essid, 34);
memcpy((char *)this->keep_essid, (char *)this->essid, 34);
memcpy((char *)signal.ssid, (char *)this->essid, WL3501_ESSID_MAX_LEN);
memcpy((char *)this->keep_essid, (char *)this->essid,
WL3501_ESSID_MAX_LEN);
signal.bss_type = this->net_type = IW_MODE_INFRA ?
WL3501_NET_TYPE_INFRA : WL3501_NET_TYPE_INFRA;
signal.beacon_period = 400;
......@@ -1097,7 +1098,8 @@ static void wl3501_mgmt_join_confirm(struct net_device *dev, u16 addr)
ETH_ALEN);
this->chan = this->bss_set[i].phy_pset[2];
memcpy((char *)this->keep_essid,
(char *)this->bss_set[i].ssid, 34);
(char *)this->bss_set[i].ssid,
WL3501_ESSID_MAX_LEN);
wl3501_mgmt_auth(this);
}
} else {
......@@ -1106,7 +1108,8 @@ static void wl3501_mgmt_join_confirm(struct net_device *dev, u16 addr)
(char *)&(this->bss_set[i].bssid), ETH_ALEN);
this->chan = this->bss_set[i].phy_pset[2];
memcpy((char *)this->keep_essid,
(char *)this->bss_set[i].ssid, 34);
(char *)this->bss_set[i].ssid,
WL3501_ESSID_MAX_LEN);
wl3501_online(dev);
}
} else {
......@@ -1759,8 +1762,9 @@ static int wl3501_ioctl(struct net_device *dev, struct ifreq *rq, int cmd)
parm.version[1] = this->version[1];
parm.freq_domain = this->freq_domain;
memcpy((char *)&(parm.keep_essid[0]),
(char *)&(this->keep_essid[0]), 34);
memcpy((char *)&(parm.essid[0]), (char *)&(this->essid[0]), 34);
(char *)&(this->keep_essid[0]), WL3501_ESSID_MAX_LEN);
memcpy((char *)&(parm.essid[0]), (char *)&(this->essid[0]),
WL3501_ESSID_MAX_LEN);
spin_unlock_irqrestore(&this->lock, flags);
blk->len = sizeof(parm);
rc = -EFAULT;
......@@ -1778,7 +1782,8 @@ static int wl3501_ioctl(struct net_device *dev, struct ifreq *rq, int cmd)
spin_lock_irqsave(&this->lock, flags);
this->def_chan = parm.def_chan;
this->net_type = parm.net_type;
memcpy((char *)&(this->essid[0]), (char *)&(parm.essid[0]), 34);
memcpy((char *)&(this->essid[0]), (char *)&(parm.essid[0]),
WL3501_ESSID_MAX_LEN);
rc = wl3501_reset(dev);
spin_unlock_irqrestore(&this->lock, flags);
break;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment