From 4bff39dfb75743c44d429b84b3810a955b8192b2 Mon Sep 17 00:00:00 2001 From: "Gujulan Elango, Hari Prasath (H.)" Date: Wed, 13 May 2015 14:35:25 +0000 Subject: staging: wlan-ng: check return value of kmalloc check return value of kmalloc before accessing the memory pointer and return -ENOMEM if allocation fails. Signed-off-by: Hari Prasath Gujulan Elango Signed-off-by: Greg Kroah-Hartman --- drivers/staging/wlan-ng/p80211conv.c | 2 ++ 1 file changed, 2 insertions(+) (limited to 'drivers/staging/wlan-ng') diff --git a/drivers/staging/wlan-ng/p80211conv.c b/drivers/staging/wlan-ng/p80211conv.c index bd69e8cf200f..c0e6ac8a28eb 100644 --- a/drivers/staging/wlan-ng/p80211conv.c +++ b/drivers/staging/wlan-ng/p80211conv.c @@ -207,6 +207,8 @@ int skb_ether_to_p80211(wlandevice_t *wlandev, u32 ethconv, /* XXXX need to pick keynum other than default? */ p80211_wep->data = kmalloc(skb->len, GFP_ATOMIC); + if (!p80211_wep->data) + return -ENOMEM; foo = wep_encrypt(wlandev, skb->data, p80211_wep->data, skb->len, (wlandev->hostwep & HOSTWEP_DEFAULTKEY_MASK), -- cgit v1.2.3-59-g8ed1b From 613462e1e4d2ea64a29a06fccd3055328354bf3a Mon Sep 17 00:00:00 2001 From: chaehyun lim Date: Fri, 15 May 2015 22:13:43 +0900 Subject: staging: wlan-ng: fix checkpatch warnings clean up checkpatch.pl in prism2sta.c WARNING : line over 80 characters Signed-off-by: chaehyun lim Signed-off-by: Greg Kroah-Hartman --- drivers/staging/wlan-ng/prism2sta.c | 23 ++++++++++++++--------- 1 file changed, 14 insertions(+), 9 deletions(-) (limited to 'drivers/staging/wlan-ng') diff --git a/drivers/staging/wlan-ng/prism2sta.c b/drivers/staging/wlan-ng/prism2sta.c index ddb294e7044f..0329c521d17c 100644 --- a/drivers/staging/wlan-ng/prism2sta.c +++ b/drivers/staging/wlan-ng/prism2sta.c @@ -428,7 +428,8 @@ u32 prism2sta_ifstate(wlandevice_t *wlandev, u32 ifstate) result = hfa384x_drvr_start(hw); if (result) { netdev_err(wlandev->netdev, - "hfa384x_drvr_start() failed,result=%d\n", (int)result); + "hfa384x_drvr_start() failed,result=%d\n", + (int)result); result = P80211ENUM_resultcode_implementation_failure; wlandev->msdstate = WLAN_MSD_HWPRESENT; @@ -471,7 +472,8 @@ u32 prism2sta_ifstate(wlandevice_t *wlandev, u32 ifstate) result = hfa384x_drvr_start(hw); if (result) { netdev_err(wlandev->netdev, - "hfa384x_drvr_start() failed,result=%d\n", (int)result); + "hfa384x_drvr_start() failed,result=%d\n", + (int)result); result = P80211ENUM_resultcode_implementation_failure; wlandev->msdstate = WLAN_MSD_HWPRESENT; @@ -481,7 +483,8 @@ u32 prism2sta_ifstate(wlandevice_t *wlandev, u32 ifstate) result = prism2sta_getcardinfo(wlandev); if (result) { netdev_err(wlandev->netdev, - "prism2sta_getcardinfo() failed,result=%d\n", (int)result); + "prism2sta_getcardinfo() failed,result=%d\n", + (int)result); result = P80211ENUM_resultcode_implementation_failure; hfa384x_drvr_stop(hw); @@ -491,7 +494,8 @@ u32 prism2sta_ifstate(wlandevice_t *wlandev, u32 ifstate) result = prism2sta_globalsetup(wlandev); if (result) { netdev_err(wlandev->netdev, - "prism2sta_globalsetup() failed,result=%d\n", (int)result); + "prism2sta_globalsetup() failed,result=%d\n", + (int)result); result = P80211ENUM_resultcode_implementation_failure; hfa384x_drvr_stop(hw); @@ -1244,9 +1248,9 @@ void prism2sta_processing_defer(struct work_struct *data) HFA384x_RID_CURRENTSSID, result); return; } - prism2mgmt_bytestr2pstr((struct hfa384x_bytestr *) &ssid, - (p80211pstrd_t *) & - wlandev->ssid); + prism2mgmt_bytestr2pstr( + (struct hfa384x_bytestr *) &ssid, + (p80211pstrd_t *) &wlandev->ssid); /* Collect the port status */ result = hfa384x_drvr_getconfig16(hw, @@ -1658,8 +1662,9 @@ static void prism2sta_inf_authreq_defer(wlandevice_t *wlandev, if (hw->authlist.cnt >= WLAN_AUTH_MAX) { rec.status = P80211ENUM_status_ap_full; } else { - ether_addr_copy(hw->authlist.addr[hw->authlist.cnt], - rec.address); + ether_addr_copy( + hw->authlist.addr[hw->authlist.cnt], + rec.address); hw->authlist.cnt++; added = 1; } -- cgit v1.2.3-59-g8ed1b From cfa6954ced97004242057b48b0e30113a02c19c4 Mon Sep 17 00:00:00 2001 From: Douglas Barbonaglia Sathler Figueiredo Date: Mon, 1 Jun 2015 10:37:11 -0300 Subject: staging: wlan-ng: fix long line Style (line over 80 chars) in drivers/staging/wlan-ng/prism2fw.c Signed-off-by: Douglas Barbonaglia Sathler Figueiredo Signed-off-by: Greg Kroah-Hartman --- drivers/staging/wlan-ng/prism2fw.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) (limited to 'drivers/staging/wlan-ng') diff --git a/drivers/staging/wlan-ng/prism2fw.c b/drivers/staging/wlan-ng/prism2fw.c index 9408644cc8b8..fe36613589ae 100644 --- a/drivers/staging/wlan-ng/prism2fw.c +++ b/drivers/staging/wlan-ng/prism2fw.c @@ -708,7 +708,10 @@ static int plugimage(struct imgchunk *fchunk, unsigned int nfchunks, continue; } - /* Validate plug address against chunk data and identify chunk */ + /* + * Validate plug address against + * chunk data and identify chunk + */ for (c = 0; c < nfchunks; c++) { cstart = fchunk[c].addr; cend = fchunk[c].addr + fchunk[c].len; @@ -923,7 +926,8 @@ static int read_fwfile(const struct ihex_binrec *record) rcnt, s3info[ns3info].len, s3info[ns3info].type); - if (((s3info[ns3info].len - 1) * sizeof(u16)) > sizeof(s3info[ns3info].info)) { + if (((s3info[ns3info].len - 1) * sizeof(u16)) > + sizeof(s3info[ns3info].info)) { pr_err("S3 inforec length too long - aborting\n"); return 1; } -- cgit v1.2.3-59-g8ed1b From 4c6b0ec2f1cf08419a08c189fd713a810ca9e86a Mon Sep 17 00:00:00 2001 From: Hari Prasath Gujulan Elango Date: Mon, 15 Jun 2015 11:48:53 +0000 Subject: staging: wlan-ng: Replace hard coded values with MACRO's This patch replaces hard coded values with global definitions for the Ethernet IEEE 802.3 interface defined in standard header file. Signed-off-by: Hari Prasath Gujulan Elango Signed-off-by: Greg Kroah-Hartman --- drivers/staging/wlan-ng/p80211conv.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'drivers/staging/wlan-ng') diff --git a/drivers/staging/wlan-ng/p80211conv.c b/drivers/staging/wlan-ng/p80211conv.c index c0e6ac8a28eb..49f2ef88929d 100644 --- a/drivers/staging/wlan-ng/p80211conv.c +++ b/drivers/staging/wlan-ng/p80211conv.c @@ -129,7 +129,7 @@ int skb_ether_to_p80211(wlandevice_t *wlandev, u32 ethconv, } else { /* step 1: classify ether frame, DIX or 802.3? */ proto = ntohs(e_hdr.type); - if (proto <= 1500) { + if (proto <= ETH_DATA_LEN) { pr_debug("802.3 len: %d\n", skb->len); /* codes <= 1500 reserved for 802.3 lengths */ /* it's 802.3, pass ether payload unchanged, */ @@ -531,7 +531,7 @@ int p80211_stt_findproto(u16 proto) Need to do some testing to confirm. */ - if (proto == 0x80f3) /* APPLETALK */ + if (proto == ETH_P_AARP) /* APPLETALK */ return 1; return 0; -- cgit v1.2.3-59-g8ed1b From 81b726619d55226d1592e398ea398406a1aa1b1b Mon Sep 17 00:00:00 2001 From: Hari Prasath Gujulan Elango Date: Thu, 18 Jun 2015 06:03:17 +0000 Subject: staging: wlan-ng: Remove ununsed debug print & associated macro This patch removed a undefined macro and debug prints associated with it. Signed-off-by: Hari Prasath Gujulan Elango Signed-off-by: Greg Kroah-Hartman --- drivers/staging/wlan-ng/p80211wep.c | 14 -------------- 1 file changed, 14 deletions(-) (limited to 'drivers/staging/wlan-ng') diff --git a/drivers/staging/wlan-ng/p80211wep.c b/drivers/staging/wlan-ng/p80211wep.c index c4fabadf5d74..c363456d93a3 100644 --- a/drivers/staging/wlan-ng/p80211wep.c +++ b/drivers/staging/wlan-ng/p80211wep.c @@ -53,7 +53,6 @@ #include #include -/* #define WEP_DEBUG */ #include "p80211hdr.h" #include "p80211types.h" @@ -133,10 +132,6 @@ int wep_change_key(wlandevice_t *wlandev, int keynum, u8 *key, int keylen) if (keynum >= NUM_WEPKEYS) return -1; -#ifdef WEP_DEBUG - pr_debug("WEP key %d len %d = %*phC\n", keynum, keylen, - 8, key); -#endif wlandev->wep_keylens[keynum] = keylen; memcpy(wlandev->wep_keys[keynum], key, keylen); @@ -181,10 +176,6 @@ int wep_decrypt(wlandevice_t *wlandev, u8 *buf, u32 len, int key_override, keylen += 3; /* add in IV bytes */ -#ifdef WEP_DEBUG - pr_debug("D %d: %*ph (%d %d) %*phC\n", len, 3, key, - keyidx, keylen, 5, key + 3); -#endif /* set up the RC4 state */ for (i = 0; i < 256; i++) @@ -258,11 +249,6 @@ int wep_encrypt(wlandevice_t *wlandev, u8 *buf, u8 *dst, u32 len, int keynum, keylen += 3; /* add in IV bytes */ -#ifdef WEP_DEBUG - pr_debug("E %d (%d/%d %d) %*ph %*phC\n", len, - iv[3], keynum, keylen, 3, key, 5, key + 3); -#endif - /* set up the RC4 state */ for (i = 0; i < 256; i++) s[i] = i; -- cgit v1.2.3-59-g8ed1b