* [PATCH] Staging: rtl8187se: fix styling issues in r8180_wx.c
@ 2014-01-05 21:17 Dan LaManna
2014-01-05 21:45 ` Dan Carpenter
0 siblings, 1 reply; 5+ messages in thread
From: Dan LaManna @ 2014-01-05 21:17 UTC (permalink / raw)
To: gregkh, teobaluta, andrea.merello, linville, rusty
Cc: devel, linux-kernel, Dan LaManna
This is a patch to the r8180_wx.c which fixes various whitespace issues,
brace issues, and casting/declaration syntax issues.
Signed-off-by: Dan LaManna <dan.lamanna@gmail.com>
---
drivers/staging/rtl8187se/r8180_wx.c | 28 ++++++++++++++--------------
1 file changed, 14 insertions(+), 14 deletions(-)
diff --git a/drivers/staging/rtl8187se/r8180_wx.c b/drivers/staging/rtl8187se/r8180_wx.c
index 4e01653..7b4adac 100644
--- a/drivers/staging/rtl8187se/r8180_wx.c
+++ b/drivers/staging/rtl8187se/r8180_wx.c
@@ -61,7 +61,7 @@ static int r8180_wx_set_key(struct net_device *dev,
return 0;
if (erq->length > 0) {
- u32* tkey = (u32*) key;
+ u32 *tkey = (u32 *) key;
priv->key0[0] = tkey[0];
priv->key0[1] = tkey[1];
priv->key0[2] = tkey[2];
@@ -295,7 +295,7 @@ static int rtl8180_wx_get_range(struct net_device *dev,
}
if (val == IW_MAX_FREQUENCIES)
- break;
+ break;
}
range->num_frequency = val;
@@ -311,14 +311,14 @@ static int r8180_wx_set_scan(struct net_device *dev, struct iw_request_info *a,
{
struct r8180_priv *priv = ieee80211_priv(dev);
int ret;
- struct ieee80211_device* ieee = priv->ieee80211;
+ struct ieee80211_device *ieee = priv->ieee80211;
if (priv->ieee80211->bHwRadioOff)
return 0;
if (wrqu->data.flags & IW_SCAN_THIS_ESSID) {
- struct iw_scan_req* req = (struct iw_scan_req*)b;
+ struct iw_scan_req *req = (struct iw_scan_req *)b;
if (req->essid_len) {
ieee->current_network.ssid_len = req->essid_len;
memcpy(ieee->current_network.ssid, req->essid, req->essid_len);
@@ -516,7 +516,8 @@ static int r8180_wx_set_enc(struct net_device *dev,
down(&priv->wx_sem);
- if (priv->hw_wep) ret = r8180_wx_set_key(dev, info, wrqu, key);
+ if (priv->hw_wep)
+ ret = r8180_wx_set_key(dev, info, wrqu, key);
else {
DMESG("Setting SW wep key");
ret = ieee80211_wx_set_encode(priv->ieee80211, info, wrqu, key);
@@ -541,7 +542,7 @@ static int r8180_wx_set_scan_type(struct net_device *dev, struct iw_request_info
iwreq_data *wrqu, char *p) {
struct r8180_priv *priv = ieee80211_priv(dev);
- int *parms = (int*)p;
+ int *parms = (int *)p;
int mode = parms[0];
if (priv->ieee80211->bHwRadioOff)
@@ -872,7 +873,7 @@ static int r8180_wx_set_preamble(struct net_device *dev,
if (*extra < 0 || *extra > 2)
ret = -1;
else
- priv->plcp_preamble_mode = *((short *)extra) ;
+ priv->plcp_preamble_mode = *((short *)extra);
@@ -1035,7 +1036,7 @@ static int r8180_wx_set_channelplan(struct net_device *dev,
/* Set new channel map */
for (i = 1; i <= DefaultChannelPlan[*val].Len; i++)
GET_DOT11D_INFO(priv->ieee80211)->channel_map[DefaultChannelPlan[*val].Channel[i-1]] = 1;
-
+
}
up(&priv->wx_sem);
@@ -1070,8 +1071,7 @@ static int r8180_wx_set_forcerate(struct net_device *dev,
printk("==============>%s(): forcerate is %d\n", __func__, forcerate);
if ((forcerate == 2) || (forcerate == 4) || (forcerate == 11) || (forcerate == 22) || (forcerate == 12) ||
(forcerate == 18) || (forcerate == 24) || (forcerate == 36) || (forcerate == 48) || (forcerate == 72) ||
- (forcerate == 96) || (forcerate == 108))
- {
+ (forcerate == 96) || (forcerate == 108)) {
priv->ForcedDataRate = 1;
priv->ieee80211->rate = forcerate * 5;
} else if (forcerate == 0) {
@@ -1358,22 +1358,22 @@ static inline int is_same_network(struct ieee80211_network *src,
* We treat all <hidden> with the same BSSID and channel
* as one network
*/
- return (((src->ssid_len == dst->ssid_len) || (ieee->iw_mode == IW_MODE_INFRA)) && /* YJ,mod, 080819,for hidden ap */
+ return ((src->ssid_len == dst->ssid_len) || (ieee->iw_mode == IW_MODE_INFRA)) && /* YJ,mod, 080819,for hidden ap */
(src->channel == dst->channel) &&
!memcmp(src->bssid, dst->bssid, ETH_ALEN) &&
(!memcmp(src->ssid, dst->ssid, src->ssid_len) || (ieee->iw_mode == IW_MODE_INFRA)) && /* YJ,mod, 080819,for hidden ap */
((src->capability & WLAN_CAPABILITY_IBSS) ==
(dst->capability & WLAN_CAPABILITY_IBSS)) &&
((src->capability & WLAN_CAPABILITY_BSS) ==
- (dst->capability & WLAN_CAPABILITY_BSS)));
+ (dst->capability & WLAN_CAPABILITY_BSS));
}
/* WB modified to show signal to GUI on 18-01-2008 */
static struct iw_statistics *r8180_get_wireless_stats(struct net_device *dev)
{
struct r8180_priv *priv = ieee80211_priv(dev);
- struct ieee80211_device* ieee = priv->ieee80211;
- struct iw_statistics* wstats = &priv->wstats;
+ struct ieee80211_device *ieee = priv->ieee80211;
+ struct iw_statistics *wstats = &priv->wstats;
int tmp_level = 0;
int tmp_qual = 0;
int tmp_noise = 0;
--
1.7.10.4
^ permalink raw reply related [flat|nested] 5+ messages in thread* Re: [PATCH] Staging: rtl8187se: fix styling issues in r8180_wx.c
2014-01-05 21:17 [PATCH] Staging: rtl8187se: fix styling issues in r8180_wx.c Dan LaManna
@ 2014-01-05 21:45 ` Dan Carpenter
2014-01-05 21:56 ` Dan Carpenter
2014-01-05 22:49 ` Joe Perches
0 siblings, 2 replies; 5+ messages in thread
From: Dan Carpenter @ 2014-01-05 21:45 UTC (permalink / raw)
To: Dan LaManna
Cc: gregkh, teobaluta, andrea.merello, linville, rusty, devel,
linux-kernel
On Sun, Jan 05, 2014 at 04:17:36PM -0500, Dan LaManna wrote:
> @@ -1358,22 +1358,22 @@ static inline int is_same_network(struct ieee80211_network *src,
> * We treat all <hidden> with the same BSSID and channel
> * as one network
> */
> - return (((src->ssid_len == dst->ssid_len) || (ieee->iw_mode == IW_MODE_INFRA)) && /* YJ,mod, 080819,for hidden ap */
> + return ((src->ssid_len == dst->ssid_len) || (ieee->iw_mode == IW_MODE_INFRA)) && /* YJ,mod, 080819,for hidden ap */
> (src->channel == dst->channel) &&
> !memcmp(src->bssid, dst->bssid, ETH_ALEN) &&
> (!memcmp(src->ssid, dst->ssid, src->ssid_len) || (ieee->iw_mode == IW_MODE_INFRA)) && /* YJ,mod, 080819,for hidden ap */
> ((src->capability & WLAN_CAPABILITY_IBSS) ==
> (dst->capability & WLAN_CAPABILITY_IBSS)) &&
> ((src->capability & WLAN_CAPABILITY_BSS) ==
> - (dst->capability & WLAN_CAPABILITY_BSS)));
> + (dst->capability & WLAN_CAPABILITY_BSS));
> }
>
Break this up.
if (src->channel != dst->channel)
return 0;
if (memcmp(src->bssid, dst->bssid, ETH_ALEN) != 0)
return 0;
if (ieee->iw_mode == IW_MODE_INFRA) {
if (src->ssid_len != dst->ssid_len)
return 0;
if (memcmp(src->ssid, dst->ssid, src->ssid_len) != 0)
return 0;
}
if (src->capability & WLAN_CAPABILITY_IBSS !=
dst->capability & WLAN_CAPABILITY_IBSS)
return 0;
if (src->capability & WLAN_CAPABILITY_BSS !=
dst->capability & WLAN_CAPABILITY_BSS)
return 0;
return 1;
In the original code we don't verify that dst->ssid_len is valid if
ieee->iw_mode == IW_MODE_INFRA. That means there is a potential Oops
if we read too far in the memcmp(src->ssid, dst->ssid, src->ssid_len).
I haven't reviewed the callers so it may not be a real issue.
regards,
dan carpenter
^ permalink raw reply [flat|nested] 5+ messages in thread* Re: [PATCH] Staging: rtl8187se: fix styling issues in r8180_wx.c
2014-01-05 21:45 ` Dan Carpenter
@ 2014-01-05 21:56 ` Dan Carpenter
2014-01-05 22:49 ` Joe Perches
1 sibling, 0 replies; 5+ messages in thread
From: Dan Carpenter @ 2014-01-05 21:56 UTC (permalink / raw)
To: Dan LaManna
Cc: devel, andrea.merello, gregkh, rusty, linville, linux-kernel,
teobaluta
On Mon, Jan 06, 2014 at 12:45:55AM +0300, Dan Carpenter wrote:
> On Sun, Jan 05, 2014 at 04:17:36PM -0500, Dan LaManna wrote:
> > @@ -1358,22 +1358,22 @@ static inline int is_same_network(struct ieee80211_network *src,
> > * We treat all <hidden> with the same BSSID and channel
> > * as one network
> > */
> > - return (((src->ssid_len == dst->ssid_len) || (ieee->iw_mode == IW_MODE_INFRA)) && /* YJ,mod, 080819,for hidden ap */
> > + return ((src->ssid_len == dst->ssid_len) || (ieee->iw_mode == IW_MODE_INFRA)) && /* YJ,mod, 080819,for hidden ap */
> > (src->channel == dst->channel) &&
> > !memcmp(src->bssid, dst->bssid, ETH_ALEN) &&
> > (!memcmp(src->ssid, dst->ssid, src->ssid_len) || (ieee->iw_mode == IW_MODE_INFRA)) && /* YJ,mod, 080819,for hidden ap */
> > ((src->capability & WLAN_CAPABILITY_IBSS) ==
> > (dst->capability & WLAN_CAPABILITY_IBSS)) &&
> > ((src->capability & WLAN_CAPABILITY_BSS) ==
> > - (dst->capability & WLAN_CAPABILITY_BSS)));
> > + (dst->capability & WLAN_CAPABILITY_BSS));
> > }
> >
>
> Break this up.
>
> if (src->channel != dst->channel)
> return 0;
>
> if (memcmp(src->bssid, dst->bssid, ETH_ALEN) != 0)
> return 0;
>
> if (ieee->iw_mode == IW_MODE_INFRA) {
I have this one reversed. It should be:
if (ieee->iw_mode != IW_MODE_INFRA) {
regards,
dan carpenter
^ permalink raw reply [flat|nested] 5+ messages in thread* Re: [PATCH] Staging: rtl8187se: fix styling issues in r8180_wx.c
2014-01-05 21:45 ` Dan Carpenter
2014-01-05 21:56 ` Dan Carpenter
@ 2014-01-05 22:49 ` Joe Perches
2014-01-06 7:51 ` Dan Carpenter
1 sibling, 1 reply; 5+ messages in thread
From: Joe Perches @ 2014-01-05 22:49 UTC (permalink / raw)
To: Dan Carpenter
Cc: Dan LaManna, gregkh, teobaluta, andrea.merello, linville, rusty,
devel, linux-kernel
On Mon, 2014-01-06 at 00:45 +0300, Dan Carpenter wrote:
> On Sun, Jan 05, 2014 at 04:17:36PM -0500, Dan LaManna wrote:
> > @@ -1358,22 +1358,22 @@ static inline int is_same_network(struct ieee80211_network *src,
> > * We treat all <hidden> with the same BSSID and channel
> > * as one network
> > */
> > - return (((src->ssid_len == dst->ssid_len) || (ieee->iw_mode == IW_MODE_INFRA)) && /* YJ,mod, 080819,for hidden ap */
> > + return ((src->ssid_len == dst->ssid_len) || (ieee->iw_mode == IW_MODE_INFRA)) && /* YJ,mod, 080819,for hidden ap */
> > (src->channel == dst->channel) &&
> > !memcmp(src->bssid, dst->bssid, ETH_ALEN) &&
> > (!memcmp(src->ssid, dst->ssid, src->ssid_len) || (ieee->iw_mode == IW_MODE_INFRA)) && /* YJ,mod, 080819,for hidden ap */
> > ((src->capability & WLAN_CAPABILITY_IBSS) ==
> > (dst->capability & WLAN_CAPABILITY_IBSS)) &&
> > ((src->capability & WLAN_CAPABILITY_BSS) ==
> > - (dst->capability & WLAN_CAPABILITY_BSS)));
> > + (dst->capability & WLAN_CAPABILITY_BSS));
> > }
> >
>
> Break this up.
[]
> if (src->capability & WLAN_CAPABILITY_IBSS !=
> dst->capability & WLAN_CAPABILITY_IBSS)
Needs parentheses
if ((src->capability & WLAN_CAPABILITY_IBSS) !=
(dst->capability & WLAN_CAPABILITY_IBSS))
> return 0;
> if (src->capability & WLAN_CAPABILITY_BSS !=
> dst->capability & WLAN_CAPABILITY_BSS)
> return 0;
here too.
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH] Staging: rtl8187se: fix styling issues in r8180_wx.c
2014-01-05 22:49 ` Joe Perches
@ 2014-01-06 7:51 ` Dan Carpenter
0 siblings, 0 replies; 5+ messages in thread
From: Dan Carpenter @ 2014-01-06 7:51 UTC (permalink / raw)
To: Joe Perches
Cc: devel, andrea.merello, gregkh, rusty, linville, linux-kernel,
teobaluta, Dan LaManna
On Sun, Jan 05, 2014 at 02:49:20PM -0800, Joe Perches wrote:
>
> Needs parentheses
>
> if ((src->capability & WLAN_CAPABILITY_IBSS) !=
> (dst->capability & WLAN_CAPABILITY_IBSS))
>
Yeah. You are right.
regards,
dan carpenter
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2014-01-06 7:51 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-01-05 21:17 [PATCH] Staging: rtl8187se: fix styling issues in r8180_wx.c Dan LaManna
2014-01-05 21:45 ` Dan Carpenter
2014-01-05 21:56 ` Dan Carpenter
2014-01-05 22:49 ` Joe Perches
2014-01-06 7:51 ` Dan Carpenter
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox