* [PATCH v2 00/10] nl80211: Fix checkpatch.pl issues @ 2016-05-30 2:49 Kirtika Ruchandani [not found] ` <cover.1464576022.git.kirtika.ruchandani-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> ` (4 more replies) 0 siblings, 5 replies; 24+ messages in thread From: Kirtika Ruchandani @ 2016-05-30 2:49 UTC (permalink / raw) To: Johannes Berg; +Cc: linux-wireless, ruchandani.tina, netdev, Julian.Calaby This patch-set attempts to fix checkpatch.pl issues found in nl80211.c. Each patch describes the specific warnings/checks/errors it addresses. This patch-set ignores 'line over 80 chars' warnings, except for 2 cases. Please check for issues with the 'fixes' for 'alignment should match open parenthesis'. Some of them do not display correctly with git diff. This patch-set removes 3 errors, 66 warnings and 46 checks. Kirtika Ruchandani (10): nl80211: Fix checkpatch warnings nl80211: Fix checkpatch warnings about blank lines nl80211: Prefer ether_addr_copy nl80211: Fix checkpatch.pl warning about braces nl80211: Fix checkpatch.pl NULL comparison warning nl80211: Various checkpatch.pl spacing fixes nl80211: Avoid multiple assignments on same line nl80211: Fix spelling nl80211: Fix checkpatch.pl warning nl80211: Prefer kcalloc over kzalloc Changes in v2: - Break down patch into smaller independent patches as suggested by Julian Calaby.This breaks down patch 3/3 in set v1 into patches 3-10 of v2. net/wireless/nl80211.c | 301 ++++++++++++++++++++++--------------------------- 1 file changed, 136 insertions(+), 165 deletions(-) -- 2.8.0.rc3.226.g39d4020 ^ permalink raw reply [flat|nested] 24+ messages in thread
[parent not found: <cover.1464576022.git.kirtika.ruchandani-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>]
* [PATCH v2 01/10] nl80211: Fix checkpatch warnings [not found] ` <cover.1464576022.git.kirtika.ruchandani-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> @ 2016-05-30 2:50 ` Kirtika Ruchandani 2016-05-30 2:51 ` [PATCH v2 02/10] nl80211: Fix checkpatch warnings about blank lines Kirtika Ruchandani ` (4 subsequent siblings) 5 siblings, 0 replies; 24+ messages in thread From: Kirtika Ruchandani @ 2016-05-30 2:50 UTC (permalink / raw) To: Johannes Berg Cc: linux-wireless-u79uwXL29TY76Z2rM5mHXA, ruchandani.tina-Re5JQEeQqe8AvxtiuMwx3w, netdev-u79uwXL29TY76Z2rM5mHXA, Julian.Calaby-Re5JQEeQqe8AvxtiuMwx3w This patch fixes the following checkpatch.pl warnings about comments in nl80211.c : - networking block comments don't use an empty '/*' line - block comments use a trailing '*/' on a separate line Reviewed-by: Julian Calaby <julian.calaby-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> Signed-off-by: Kirtika Ruchandani <kirtika.ruchandani-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> --- net/wireless/nl80211.c | 129 +++++++++++++++++-------------------------------- 1 file changed, 45 insertions(+), 84 deletions(-) diff --git a/net/wireless/nl80211.c b/net/wireless/nl80211.c index d759901..50a0de0 100644 --- a/net/wireless/nl80211.c +++ b/net/wireless/nl80211.c @@ -196,8 +196,7 @@ __cfg80211_rdev_from_attrs(struct net *netns, struct nlattr **attrs) return rdev; } -/* - * This function returns a pointer to the driver +/* This function returns a pointer to the driver * that the genl_info item that is passed refers to. * * The result of this can be a PTR_ERR and hence must @@ -1624,8 +1623,7 @@ static int nl80211_send_wiphy(struct cfg80211_registered_device *rdev, goto nla_put_failure; features = rdev->wiphy.features; - /* - * We can only add the per-channel limit information if the + /* We can only add the per-channel limit information if the * dump is split, otherwise it makes it too big. Therefore * only advertise it in that case. */ @@ -1646,8 +1644,7 @@ static int nl80211_send_wiphy(struct cfg80211_registered_device *rdev, rdev->wiphy.max_acl_mac_addrs)) goto nla_put_failure; - /* - * Any information below this point is only available to + /* Any information below this point is only available to * applications that can deal with it being split. This * helps ensure that newly added capabilities don't break * older tools by overrunning their buffers. @@ -1847,8 +1844,7 @@ static int nl80211_dump_wiphy(struct sk_buff *skb, struct netlink_callback *cb) cb->nlh->nlmsg_seq, NLM_F_MULTI, state); if (ret < 0) { - /* - * If sending the wiphy data didn't fit (ENOBUFS + /* If sending the wiphy data didn't fit (ENOBUFS * or EMSGSIZE returned), this SKB is still * empty (so it's not too big because another * wiphy dataset is already in the skb) and @@ -1937,8 +1933,7 @@ static int parse_txq_params(struct nlattr *tb[], static bool nl80211_can_set_dev_channel(struct wireless_dev *wdev) { - /* - * You can only set the channel explicitly for WDS interfaces, + /* You can only set the channel explicitly for WDS interfaces, * all others have their channel managed via their respective * "establish a connection" command (connect, join, ...) * @@ -2131,8 +2126,7 @@ static int nl80211_set_wiphy(struct sk_buff *skb, struct genl_info *info) ASSERT_RTNL(); - /* - * Try to find the wiphy and netdev. Normally this + /* Try to find the wiphy and netdev. Normally this * function shouldn't need the netdev, but this is * done for backward compatibility -- previously * setting the channel was done per wiphy, but now @@ -2162,8 +2156,7 @@ static int nl80211_set_wiphy(struct sk_buff *skb, struct genl_info *info) } else wdev = netdev->ieee80211_ptr; - /* - * end workaround code, by now the rdev is available + /* end workaround code, by now the rdev is available * and locked, and wdev may or may not be NULL. */ @@ -2260,7 +2253,8 @@ static int nl80211_set_wiphy(struct sk_buff *skb, struct genl_info *info) rx_ant = nla_get_u32(info->attrs[NL80211_ATTR_WIPHY_ANTENNA_RX]); /* reject antenna configurations which don't match the - * available antenna masks, except for the "all" mask */ + * available antenna masks, except for the "all" mask + */ if ((~tx_ant && (tx_ant & ~rdev->wiphy.available_antennas_tx)) || (~rx_ant && (rx_ant & ~rdev->wiphy.available_antennas_rx))) return -EINVAL; @@ -2300,8 +2294,7 @@ static int nl80211_set_wiphy(struct sk_buff *skb, struct genl_info *info) return -EINVAL; if (frag_threshold != (u32) -1) { - /* - * Fragments (apart from the last one) are required to + /* Fragments (apart from the last one) are required to * have even length. Make the fragmentation code * simpler by stripping LSB should someone try to use * odd threshold value. @@ -2751,8 +2744,7 @@ static int nl80211_new_interface(struct sk_buff *skb, struct genl_info *info) wdev_unlock(wdev); break; case NL80211_IFTYPE_P2P_DEVICE: - /* - * P2P Device doesn't have a netdev, so doesn't go + /* P2P Device doesn't have a netdev, so doesn't go * through the netdev notifier and must be added here */ mutex_init(&wdev->mtx); @@ -2808,8 +2800,7 @@ static int nl80211_del_interface(struct sk_buff *skb, struct genl_info *info) msg = NULL; } - /* - * If we remove a wireless device without a netdev then clear + /* If we remove a wireless device without a netdev then clear * user_ptr[1] so that nl80211_post_doit won't dereference it * to check if it needs to do dev_put(). Otherwise it crashes * since the wdev has been freed, unlike with a netdev where @@ -3160,8 +3151,7 @@ static int validate_acl_mac_addrs(struct nlattr *nl_attr) return n_entries; } -/* - * This function parses ACL information and allocates memory for ACL data. +/* This function parses ACL information and allocates memory for ACL data. * On successful return, the calling function is responsible to free the * ACL buffer returned by this function. */ @@ -3377,8 +3367,7 @@ static int nl80211_start_ap(struct sk_buff *skb, struct genl_info *info) if (err) return err; - /* - * In theory, some of these attributes should be required here + /* In theory, some of these attributes should be required here * but since they were not used when the command was originally * added, keep them optional for old user space programs to let * them continue to work with drivers that do not need the @@ -3567,8 +3556,7 @@ static int parse_station_flags(struct genl_info *info, struct nlattr *nla; int flag; - /* - * Try parsing the new attribute first so userspace + /* Try parsing the new attribute first so userspace * can specify both for older kernels. */ nla = info->attrs[NL80211_ATTR_STA_FLAGS2]; @@ -3595,8 +3583,7 @@ static int parse_station_flags(struct genl_info *info, nla, sta_flags_policy)) return -EINVAL; - /* - * Only allow certain flags for interface types so that + /* Only allow certain flags for interface types so that * other attributes are silently ignored. Remember that * this is backward compatibility code with old userspace * and shouldn't be hit in other cases anyway. @@ -4032,8 +4019,7 @@ int cfg80211_check_station_change(struct wiphy *wiphy, switch (statype) { case CFG80211_STA_MESH_PEER_KERNEL: case CFG80211_STA_MESH_PEER_USER: - /* - * No ignoring the TDLS flag here -- the userspace mesh + /* No ignoring the TDLS flag here -- the userspace mesh * code doesn't have the bug of including TDLS in the * mask everywhere. */ @@ -4065,8 +4051,7 @@ int cfg80211_check_station_change(struct wiphy *wiphy, /* TDLS can't be set, ... */ if (params->sta_flags_set & BIT(NL80211_STA_FLAG_TDLS_PEER)) return -EINVAL; - /* - * ... but don't bother the driver with it. This works around + /* ... but don't bother the driver with it. This works around * a hostapd/wpa_supplicant issue -- it always includes the * TLDS_PEER flag in the mask even for AP mode. */ @@ -4151,8 +4136,7 @@ int cfg80211_check_station_change(struct wiphy *wiphy, } EXPORT_SYMBOL(cfg80211_check_station_change); -/* - * Get vlan interface making sure it is running and on the right wiphy. +/* Get vlan interface making sure it is running and on the right wiphy. */ static struct net_device *get_vlan(struct genl_info *info, struct cfg80211_registered_device *rdev) @@ -4239,8 +4223,7 @@ static int nl80211_parse_sta_channel_info(struct genl_info *info, nla_data(info->attrs[NL80211_ATTR_STA_SUPPORTED_CHANNELS]); params->supported_channels_len = nla_len(info->attrs[NL80211_ATTR_STA_SUPPORTED_CHANNELS]); - /* - * Need to include at least one (first channel, number of + /* Need to include at least one (first channel, number of * channels) tuple for each subband, and must have proper * tuples for the rest of the data as well. */ @@ -4255,8 +4238,7 @@ static int nl80211_parse_sta_channel_info(struct genl_info *info, nla_data(info->attrs[NL80211_ATTR_STA_SUPPORTED_OPER_CLASSES]); params->supported_oper_classes_len = nla_len(info->attrs[NL80211_ATTR_STA_SUPPORTED_OPER_CLASSES]); - /* - * The value of the Length field of the Supported Operating + /* The value of the Length field of the Supported Operating * Classes element is between 2 and 253. */ if (params->supported_oper_classes_len < 2 || @@ -4300,8 +4282,7 @@ static int nl80211_set_station(struct sk_buff *skb, struct genl_info *info) if (!rdev->ops->change_station) return -EOPNOTSUPP; - /* - * AID and listen_interval properties can be set only for unassociated + /* AID and listen_interval properties can be set only for unassociated * station. Include these parameters here and will check them in * cfg80211_check_station_change(). */ @@ -4458,8 +4439,7 @@ static int nl80211_new_station(struct sk_buff *skb, struct genl_info *info) params.support_p2p_ps = tmp; } else { - /* - * if not specified, assume it's supported for P2P GO interface, + /* if not specified, assume it's supported for P2P GO interface, * and is NOT supported for AP interface */ params.support_p2p_ps = @@ -4604,8 +4584,7 @@ static int nl80211_new_station(struct sk_buff *skb, struct genl_info *info) /* ... with external setup is supported */ if (!(rdev->wiphy.flags & WIPHY_FLAG_TDLS_EXTERNAL_SETUP)) return -EOPNOTSUPP; - /* - * Older wpa_supplicant versions always mark the TDLS peer + /* Older wpa_supplicant versions always mark the TDLS peer * as authorized, but it shouldn't yet be. */ params.sta_flags_mask &= ~BIT(NL80211_STA_FLAG_AUTHORIZED); @@ -5054,8 +5033,7 @@ static int nl80211_req_set_reg(struct sk_buff *skb, struct genl_info *info) u32 owner_nlportid; - /* - * You should only get this when cfg80211 hasn't yet initialized + /* You should only get this when cfg80211 hasn't yet initialized * completely when built-in to the kernel right between the time * window between nl80211_init() and regulatory_init(), if that is * even possible. @@ -5271,7 +5249,8 @@ do { \ return -EINVAL; /* This makes sure that there aren't more than 32 mesh config - * parameters (otherwise our bitfield scheme would not work.) */ + * parameters (otherwise our bitfield scheme would not work.) + */ BUILD_BUG_ON(NL80211_MESHCONF_ATTR_MAX > 32); /* Fill in the params struct */ @@ -5770,8 +5749,7 @@ static int nl80211_set_reg(struct sk_buff *skb, struct genl_info *info) rd->alpha2[0] = alpha2[0]; rd->alpha2[1] = alpha2[1]; - /* - * Disable DFS master mode if the DFS region was + /* Disable DFS master mode if the DFS region was * not supported or known on this kernel. */ if (reg_supported_dfs_region(dfs_region)) @@ -5813,8 +5791,7 @@ static int validate_scan_freqs(struct nlattr *freqs) nla_for_each_nested(attr1, freqs, tmp1) { n_channels++; - /* - * Some hardware has a limited channel list for + /* Some hardware has a limited channel list for * scanning, and it is pretty much nonsensical * to scan for a channel twice, so disallow that * and don't require drivers to check that the @@ -5924,8 +5901,7 @@ static int nl80211_parse_random_mac(struct nlattr **attrs, is_multicast_ether_addr(mac_addr)) return -EINVAL; - /* - * allow users to pass a MAC address that has bits set outside + /* allow users to pass a MAC address that has bits set outside * of the mask, but don't bother drivers with having to deal * with such bits */ @@ -6192,8 +6168,7 @@ nl80211_parse_sched_scan_plans(struct wiphy *wiphy, int n_plans, if (!attrs[NL80211_ATTR_SCHED_SCAN_PLANS]) { u32 interval; - /* - * If scan plans are not specified, + /* If scan plans are not specified, * %NL80211_ATTR_SCHED_SCAN_INTERVAL must be specified. In this * case one scan plan will be set with the specified scan * interval and infinite number of iterations. @@ -6248,8 +6223,7 @@ nl80211_parse_sched_scan_plans(struct wiphy *wiphy, int n_plans, wiphy->max_sched_scan_plan_iterations)) return -EINVAL; } else if (i < n_plans - 1) { - /* - * All scan plans but the last one must specify + /* All scan plans but the last one must specify * a finite number of iterations */ return -EINVAL; @@ -6258,8 +6232,7 @@ nl80211_parse_sched_scan_plans(struct wiphy *wiphy, int n_plans, i++; } - /* - * The last scan plan must not specify the number of + /* The last scan plan must not specify the number of * iterations, it is supposed to run infinitely */ if (request->scan_plans[n_plans - 1].iterations) @@ -6300,8 +6273,7 @@ nl80211_parse_sched_scan(struct wiphy *wiphy, struct wireless_dev *wdev, if (n_ssids > wiphy->max_sched_scan_ssids) return ERR_PTR(-EINVAL); - /* - * First, count the number of 'real' matchsets. Due to an issue with + /* First, count the number of 'real' matchsets. Due to an issue with * the old implementation, matchsets containing only the RSSI attribute * (NL80211_SCHED_SCAN_MATCH_ATTR_RSSI) are considered as the 'default' * RSSI for all matchsets, rather than their own matchset for reporting @@ -6347,8 +6319,7 @@ nl80211_parse_sched_scan(struct wiphy *wiphy, struct wireless_dev *wdev, return ERR_PTR(-EINVAL); if (attrs[NL80211_ATTR_SCHED_SCAN_PLANS]) { - /* - * NL80211_ATTR_SCHED_SCAN_INTERVAL must not be specified since + /* NL80211_ATTR_SCHED_SCAN_INTERVAL must not be specified since * each scan plan already specifies its own interval */ if (attrs[NL80211_ATTR_SCHED_SCAN_INTERVAL]) @@ -6358,8 +6329,7 @@ nl80211_parse_sched_scan(struct wiphy *wiphy, struct wireless_dev *wdev, attrs[NL80211_ATTR_SCHED_SCAN_PLANS], tmp) n_plans++; } else { - /* - * The scan interval attribute is kept for backward + /* The scan interval attribute is kept for backward * compatibility. If no scan plans are specified and sched scan * interval is specified, one scan plan will be set with this * scan interval and infinite number of iterations. @@ -7255,8 +7225,7 @@ static int nl80211_authenticate(struct sk_buff *skb, struct genl_info *info) local_state_change = !!info->attrs[NL80211_ATTR_LOCAL_STATE_CHANGE]; - /* - * Since we no longer track auth state, ignore + /* Since we no longer track auth state, ignore * requests to only change local state. */ if (local_state_change) @@ -7918,8 +7887,7 @@ static int nl80211_testmode_dump(struct sk_buff *skb, rtnl_lock(); if (cb->args[0]) { - /* - * 0 is a valid index, but not valid for args[0], + /* 0 is a valid index, but not valid for args[0], * so we need to offset by 1. */ phy_idx = cb->args[0] - 1; @@ -8364,8 +8332,7 @@ static int nl80211_remain_on_channel(struct sk_buff *skb, !(rdev->wiphy.flags & WIPHY_FLAG_HAS_REMAIN_ON_CHANNEL)) return -EOPNOTSUPP; - /* - * We should be on that channel for at least a minimum amount of + /* We should be on that channel for at least a minimum amount of * time (10ms) but no longer than the driver supports. */ if (duration < NL80211_MIN_REMAIN_ON_CHANNEL_TIME || @@ -8586,8 +8553,7 @@ static int nl80211_set_tx_bitrate_mask(struct sk_buff *skb, if (!info->attrs[NL80211_ATTR_TX_RATES]) goto out; - /* - * The nested attribute uses enum nl80211_band as the index. This maps + /* The nested attribute uses enum nl80211_band as the index. This maps * directly to the enum nl80211_band values used in cfg80211. */ BUILD_BUG_ON(NL80211_MAX_SUPP_HT_RATES > IEEE80211_HT_MCS_MASK_LEN * 8); @@ -8736,8 +8702,7 @@ static int nl80211_tx_mgmt(struct sk_buff *skb, struct genl_info *info) return -EINVAL; params.wait = nla_get_u32(info->attrs[NL80211_ATTR_DURATION]); - /* - * We should wait on the channel for at least a minimum amount + /* We should wait on the channel for at least a minimum amount * of time (10ms) but no longer than the driver supports. */ if (params.wait < NL80211_MIN_REMAIN_ON_CHANNEL_TIME || @@ -10758,8 +10723,7 @@ static int nl80211_tdls_channel_switch(struct sk_buff *skb, if (err) return err; - /* - * Don't allow wide channels on the 2.4Ghz band, as per IEEE802.11-2012 + /* Don't allow wide channels on the 2.4Ghz band, as per IEEE802.11-2012 * section 10.22.6.2.1. Disallow 5/10Mhz channels as well for now, the * specification is not defined for them. */ @@ -11899,8 +11863,7 @@ nla_put_failure: return false; } -/* - * This can happen on global regulatory changes or device specific settings +/* This can happen on global regulatory changes or device specific settings * based on custom regulatory domains. */ void nl80211_common_reg_change_event(enum nl80211_commands cmd_id, @@ -12337,8 +12300,7 @@ void nl80211_send_beacon_hint_event(struct wiphy *wiphy, return; } - /* - * Since we are applying the beacon hint to a wiphy we know its + /* Since we are applying the beacon hint to a wiphy we know its * wiphy_idx is valid */ if (nla_put_u32(msg, NL80211_ATTR_WIPHY, get_wiphy_idx(wiphy))) @@ -13453,8 +13415,7 @@ static int nl80211_netlink_notify(struct notifier_block * nb, rcu_read_unlock(); - /* - * It is possible that the user space process that is controlling the + /* It is possible that the user space process that is controlling the * indoor setting disappeared, so notify the regulatory core. */ regulatory_netlink_notify(notify->portid); -- 2.8.0.rc3.226.g39d4020 -- To unsubscribe from this list: send the line "unsubscribe linux-wireless" in the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org More majordomo info at http://vger.kernel.org/majordomo-info.html ^ permalink raw reply related [flat|nested] 24+ messages in thread
* [PATCH v2 02/10] nl80211: Fix checkpatch warnings about blank lines [not found] ` <cover.1464576022.git.kirtika.ruchandani-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> 2016-05-30 2:50 ` [PATCH v2 01/10] nl80211: Fix checkpatch warnings Kirtika Ruchandani @ 2016-05-30 2:51 ` Kirtika Ruchandani 2016-05-30 2:52 ` [PATCH v2 03/10] nl80211: Prefer ether_addr_copy Kirtika Ruchandani ` (3 subsequent siblings) 5 siblings, 0 replies; 24+ messages in thread From: Kirtika Ruchandani @ 2016-05-30 2:51 UTC (permalink / raw) To: Johannes Berg Cc: linux-wireless-u79uwXL29TY76Z2rM5mHXA, ruchandani.tina-Re5JQEeQqe8AvxtiuMwx3w, netdev-u79uwXL29TY76Z2rM5mHXA, Julian.Calaby-Re5JQEeQqe8AvxtiuMwx3w This patch fixes the following checkpatch.pl issues - - Please don't use multiple blank lines - Blank lines aren't necessary before a close brace - Missing a blank line after declarations Reviewed-by: Julian Calaby <julian.calaby-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> Signed-off-by: Kirtika Ruchandani <kirtika.ruchandani-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> --- net/wireless/nl80211.c | 22 ++++++++++------------ 1 file changed, 10 insertions(+), 12 deletions(-) diff --git a/net/wireless/nl80211.c b/net/wireless/nl80211.c index 50a0de0..cd422bd 100644 --- a/net/wireless/nl80211.c +++ b/net/wireless/nl80211.c @@ -167,6 +167,7 @@ __cfg80211_rdev_from_attrs(struct net *netns, struct nlattr **attrs) if (attrs[NL80211_ATTR_IFINDEX]) { int ifindex = nla_get_u32(attrs[NL80211_ATTR_IFINDEX]); + netdev = __dev_get_by_index(netns, ifindex); if (netdev) { if (netdev->ieee80211_ptr) @@ -730,6 +731,7 @@ static int nl80211_parse_key_new(struct nlattr *key, struct key_parse *k) if (tb[NL80211_KEY_DEFAULT_TYPES]) { struct nlattr *kdt[NUM_NL80211_KEY_DEFAULT_TYPES]; + err = nla_parse_nested(kdt, NUM_NL80211_KEY_DEFAULT_TYPES - 1, tb[NL80211_KEY_DEFAULT_TYPES], nl80211_key_default_policy); @@ -1381,6 +1383,7 @@ static int nl80211_send_wiphy(struct cfg80211_registered_device *rdev, rdev->ops->get_antenna) { u32 tx_ant = 0, rx_ant = 0; int res; + res = rdev_get_antenna(rdev, &tx_ant, &rx_ant); if (!res) { if (nla_put_u32(msg, @@ -2111,7 +2114,6 @@ static int nl80211_set_wds_peer(struct sk_buff *skb, struct genl_info *info) return rdev_set_wds_peer(rdev, dev, bssid); } - static int nl80211_set_wiphy(struct sk_buff *skb, struct genl_info *info) { struct cfg80211_registered_device *rdev; @@ -2244,6 +2246,7 @@ static int nl80211_set_wiphy(struct sk_buff *skb, struct genl_info *info) if (info->attrs[NL80211_ATTR_WIPHY_ANTENNA_TX] && info->attrs[NL80211_ATTR_WIPHY_ANTENNA_RX]) { u32 tx_ant, rx_ant; + if ((!rdev->wiphy.available_antennas_tx && !rdev->wiphy.available_antennas_rx) || !rdev->ops->set_antenna) @@ -2910,6 +2913,7 @@ static int nl80211_get_key(struct sk_buff *skb, struct genl_info *info) pairwise = !!mac_addr; if (info->attrs[NL80211_ATTR_KEY_TYPE]) { u32 kt = nla_get_u32(info->attrs[NL80211_ATTR_KEY_TYPE]); + if (kt >= NUM_NL80211_KEYTYPES) return -EINVAL; if (kt != NL80211_KEYTYPE_GROUP && @@ -3949,7 +3953,6 @@ static int nl80211_dump_station(struct sk_buff *skb, sta_idx++; } - out: cb->args[2] = sta_idx; err = skb->len; @@ -4742,7 +4745,6 @@ static int nl80211_dump_mpath(struct sk_buff *skb, path_idx++; } - out: cb->args[2] = path_idx; err = skb->len; @@ -5032,7 +5034,6 @@ static int nl80211_req_set_reg(struct sk_buff *skb, struct genl_info *info) enum nl80211_user_reg_hint_type user_reg_hint_type; u32 owner_nlportid; - /* You should only get this when cfg80211 hasn't yet initialized * completely when built-in to the kernel right between the time * window between nl80211_init() and regulatory_init(), if that is @@ -5240,7 +5241,6 @@ do { \ } \ } while (0) - if (!info->attrs[NL80211_ATTR_MESH_CONFIG]) return -EINVAL; if (nla_parse_nested(tb, NL80211_MESHCONF_ATTR_MAX, @@ -5388,7 +5388,6 @@ static int nl80211_parse_mesh_setup(struct genl_info *info, IEEE80211_PATH_METRIC_VENDOR : IEEE80211_PATH_METRIC_AIRTIME; - if (tb[NL80211_MESH_SETUP_IE]) { struct nlattr *ieattr = tb[NL80211_MESH_SETUP_IE]; @@ -6009,6 +6008,7 @@ static int nl80211_trigger_scan(struct sk_buff *skb, struct genl_info *info) /* all channels */ for (band = 0; band < NUM_NL80211_BANDS; band++) { int j; + if (!wiphy->bands[band]) continue; for (j = 0; j < wiphy->bands[band]->n_channels; j++) { @@ -6412,6 +6412,7 @@ nl80211_parse_sched_scan(struct wiphy *wiphy, struct wireless_dev *wdev, /* all channels */ for (band = 0; band < NUM_NL80211_BANDS; band++) { int j; + if (!wiphy->bands[band]) continue; for (j = 0; j < wiphy->bands[band]->n_channels; j++) { @@ -7174,6 +7175,7 @@ static int nl80211_authenticate(struct sk_buff *skb, struct genl_info *info) if (key.idx >= 0) { int i; bool ok = false; + for (i = 0; i < rdev->wiphy.n_cipher_suites; i++) { if (key.p.cipher == rdev->wiphy.cipher_suites[i]) { ok = true; @@ -7251,6 +7253,7 @@ static int nl80211_crypto_settings(struct cfg80211_registered_device *rdev, if (info->attrs[NL80211_ATTR_CONTROL_PORT_ETHERTYPE]) { u16 proto; + proto = nla_get_u16( info->attrs[NL80211_ATTR_CONTROL_PORT_ETHERTYPE]); settings->control_port_ethertype = cpu_to_be16(proto); @@ -8402,6 +8405,7 @@ static u32 rateset_to_mask(struct ieee80211_supported_band *sband, for (i = 0; i < rates_len; i++) { int rate = (rates[i] & 0x7f) * 5; int ridx; + for (ridx = 0; ridx < sband->n_bitrates; ridx++) { struct ieee80211_rate *srate = &sband->bitrates[ridx]; @@ -8708,7 +8712,6 @@ static int nl80211_tx_mgmt(struct sk_buff *skb, struct genl_info *info) if (params.wait < NL80211_MIN_REMAIN_ON_CHANNEL_TIME || params.wait > rdev->wiphy.max_remain_on_channel_duration) return -EINVAL; - } params.offchan = info->attrs[NL80211_ATTR_OFFCHANNEL_TX_OK]; @@ -10555,7 +10558,6 @@ int cfg80211_vendor_cmd_reply(struct sk_buff *skb) } EXPORT_SYMBOL_GPL(cfg80211_vendor_cmd_reply); - static int nl80211_set_qos_map(struct sk_buff *skb, struct genl_info *info) { @@ -12089,7 +12091,6 @@ void nl80211_send_connect_result(struct cfg80211_registered_device *rdev, nla_put_failure: genlmsg_cancel(msg, hdr); nlmsg_free(msg); - } void nl80211_send_roamed(struct cfg80211_registered_device *rdev, @@ -12128,7 +12129,6 @@ void nl80211_send_roamed(struct cfg80211_registered_device *rdev, nla_put_failure: genlmsg_cancel(msg, hdr); nlmsg_free(msg); - } void nl80211_send_disconnected(struct cfg80211_registered_device *rdev, @@ -12166,7 +12166,6 @@ void nl80211_send_disconnected(struct cfg80211_registered_device *rdev, nla_put_failure: genlmsg_cancel(msg, hdr); nlmsg_free(msg); - } void nl80211_send_ibss_bssid(struct cfg80211_registered_device *rdev, @@ -13506,7 +13505,6 @@ void cfg80211_crit_proto_stopped(struct wireless_dev *wdev, gfp_t gfp) if (hdr) genlmsg_cancel(msg, hdr); nlmsg_free(msg); ^ permalink raw reply related [flat|nested] 24+ messages in thread
* [PATCH v2 03/10] nl80211: Prefer ether_addr_copy [not found] ` <cover.1464576022.git.kirtika.ruchandani-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> 2016-05-30 2:50 ` [PATCH v2 01/10] nl80211: Fix checkpatch warnings Kirtika Ruchandani 2016-05-30 2:51 ` [PATCH v2 02/10] nl80211: Fix checkpatch warnings about blank lines Kirtika Ruchandani @ 2016-05-30 2:52 ` Kirtika Ruchandani [not found] ` <49c03996365360077fe7317d108072c30354b555.1464576022.git.kirtika.ruchandani-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> 2016-05-30 2:52 ` [PATCH v2 04/10] nl80211: Fix checkpatch.pl warning about braces Kirtika Ruchandani ` (2 subsequent siblings) 5 siblings, 1 reply; 24+ messages in thread From: Kirtika Ruchandani @ 2016-05-30 2:52 UTC (permalink / raw) To: Johannes Berg Cc: linux-wireless-u79uwXL29TY76Z2rM5mHXA, ruchandani.tina-Re5JQEeQqe8AvxtiuMwx3w, netdev-u79uwXL29TY76Z2rM5mHXA, Julian.Calaby-Re5JQEeQqe8AvxtiuMwx3w This patch fixes the checkpatch,pl to prefer ether_addr_copy over memcpy. Signed-off-by: Kirtika Ruchandani <kirtika.ruchandani-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> --- net/wireless/nl80211.c | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/net/wireless/nl80211.c b/net/wireless/nl80211.c index cd422bd..34b8fbe 100644 --- a/net/wireless/nl80211.c +++ b/net/wireless/nl80211.c @@ -3194,7 +3194,7 @@ static struct cfg80211_acl_data *parse_acl_data(struct wiphy *wiphy, return ERR_PTR(-ENOMEM); nla_for_each_nested(attr, info->attrs[NL80211_ATTR_MAC_ADDRS], tmp) { - memcpy(acl->mac_addrs[i].addr, nla_data(attr), ETH_ALEN); + ether_addr_copy(acl->mac_addrs[i].addr, nla_data(attr)); i++; } @@ -5892,8 +5892,8 @@ static int nl80211_parse_random_mac(struct nlattr **attrs, if (!attrs[NL80211_ATTR_MAC] || !attrs[NL80211_ATTR_MAC_MASK]) return -EINVAL; - memcpy(mac_addr, nla_data(attrs[NL80211_ATTR_MAC]), ETH_ALEN); - memcpy(mac_addr_mask, nla_data(attrs[NL80211_ATTR_MAC_MASK]), ETH_ALEN); + ether_addr_copy(mac_addr, nla_data(attrs[NL80211_ATTR_MAC])); + ether_addr_copy(mac_addr_mask, nla_data(attrs[NL80211_ATTR_MAC_MASK])); /* don't allow or configure an mcast address */ if (!is_multicast_ether_addr(mac_addr_mask) || @@ -9405,8 +9405,7 @@ static int nl80211_parse_wowlan_tcp(struct cfg80211_registered_device *rdev, return -ENOMEM; cfg->src = nla_get_in_addr(tb[NL80211_WOWLAN_TCP_SRC_IPV4]); cfg->dst = nla_get_in_addr(tb[NL80211_WOWLAN_TCP_DST_IPV4]); - memcpy(cfg->dst_mac, nla_data(tb[NL80211_WOWLAN_TCP_DST_MAC]), - ETH_ALEN); + ether_addr_copy(cfg->dst_mac, nla_data(tb[NL80211_WOWLAN_TCP_DST_MAC])); if (tb[NL80211_WOWLAN_TCP_SRC_PORT]) port = nla_get_u16(tb[NL80211_WOWLAN_TCP_SRC_PORT]); else -- 2.8.0.rc3.226.g39d4020 -- To unsubscribe from this list: send the line "unsubscribe linux-wireless" in the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org More majordomo info at http://vger.kernel.org/majordomo-info.html ^ permalink raw reply related [flat|nested] 24+ messages in thread
[parent not found: <49c03996365360077fe7317d108072c30354b555.1464576022.git.kirtika.ruchandani-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>]
* Re: [PATCH v2 03/10] nl80211: Prefer ether_addr_copy [not found] ` <49c03996365360077fe7317d108072c30354b555.1464576022.git.kirtika.ruchandani-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> @ 2016-05-30 5:21 ` Julian Calaby 2016-05-30 6:50 ` Kirtika Ruchandani 0 siblings, 1 reply; 24+ messages in thread From: Julian Calaby @ 2016-05-30 5:21 UTC (permalink / raw) To: Kirtika Ruchandani; +Cc: Johannes Berg, linux-wireless, Tina Ruchandani, netdev Hi All, On Mon, May 30, 2016 at 12:52 PM, Kirtika Ruchandani <kirtika.ruchandani-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote: > This patch fixes the checkpatch,pl to prefer ether_addr_copy > over memcpy. > > Signed-off-by: Kirtika Ruchandani <kirtika.ruchandani-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> This looks right to me, but doesn't ether_addr_copy() have alignment requirements? Could someone more familiar with that review these changes to ensure they're met? Thanks, Julian Calaby > --- > net/wireless/nl80211.c | 9 ++++----- > 1 file changed, 4 insertions(+), 5 deletions(-) > > diff --git a/net/wireless/nl80211.c b/net/wireless/nl80211.c > index cd422bd..34b8fbe 100644 > --- a/net/wireless/nl80211.c > +++ b/net/wireless/nl80211.c > @@ -3194,7 +3194,7 @@ static struct cfg80211_acl_data *parse_acl_data(struct wiphy *wiphy, > return ERR_PTR(-ENOMEM); > > nla_for_each_nested(attr, info->attrs[NL80211_ATTR_MAC_ADDRS], tmp) { > - memcpy(acl->mac_addrs[i].addr, nla_data(attr), ETH_ALEN); > + ether_addr_copy(acl->mac_addrs[i].addr, nla_data(attr)); > i++; > } > > @@ -5892,8 +5892,8 @@ static int nl80211_parse_random_mac(struct nlattr **attrs, > if (!attrs[NL80211_ATTR_MAC] || !attrs[NL80211_ATTR_MAC_MASK]) > return -EINVAL; > > - memcpy(mac_addr, nla_data(attrs[NL80211_ATTR_MAC]), ETH_ALEN); > - memcpy(mac_addr_mask, nla_data(attrs[NL80211_ATTR_MAC_MASK]), ETH_ALEN); > + ether_addr_copy(mac_addr, nla_data(attrs[NL80211_ATTR_MAC])); > + ether_addr_copy(mac_addr_mask, nla_data(attrs[NL80211_ATTR_MAC_MASK])); > > /* don't allow or configure an mcast address */ > if (!is_multicast_ether_addr(mac_addr_mask) || > @@ -9405,8 +9405,7 @@ static int nl80211_parse_wowlan_tcp(struct cfg80211_registered_device *rdev, > return -ENOMEM; > cfg->src = nla_get_in_addr(tb[NL80211_WOWLAN_TCP_SRC_IPV4]); > cfg->dst = nla_get_in_addr(tb[NL80211_WOWLAN_TCP_DST_IPV4]); > - memcpy(cfg->dst_mac, nla_data(tb[NL80211_WOWLAN_TCP_DST_MAC]), > - ETH_ALEN); > + ether_addr_copy(cfg->dst_mac, nla_data(tb[NL80211_WOWLAN_TCP_DST_MAC])); > if (tb[NL80211_WOWLAN_TCP_SRC_PORT]) > port = nla_get_u16(tb[NL80211_WOWLAN_TCP_SRC_PORT]); > else > -- > 2.8.0.rc3.226.g39d4020 > -- Julian Calaby Email: julian.calaby-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org Profile: http://www.google.com/profiles/julian.calaby/ -- To unsubscribe from this list: send the line "unsubscribe linux-wireless" in the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org More majordomo info at http://vger.kernel.org/majordomo-info.html ^ permalink raw reply [flat|nested] 24+ messages in thread
* Re: [PATCH v2 03/10] nl80211: Prefer ether_addr_copy 2016-05-30 5:21 ` Julian Calaby @ 2016-05-30 6:50 ` Kirtika Ruchandani 2016-05-31 10:34 ` Johannes Berg 0 siblings, 1 reply; 24+ messages in thread From: Kirtika Ruchandani @ 2016-05-30 6:50 UTC (permalink / raw) To: Julian Calaby; +Cc: Johannes Berg, linux-wireless, Tina Ruchandani, netdev > This looks right to me, but doesn't ether_addr_copy() have alignment > requirements? Could someone more familiar with that review these > changes to ensure they're met? Thanks for catching this. The requirement is to be __aligned(2). I've added 4 instances of ether_addr_copy with 8 addresses as arguments. Of these, the 4 src arguments are really the same type (i.e. nla_data acting on a const nlattr*), so I'll try to reason about the 5 total cases below - 1. cfg->dst_mac should be 16-bit aligned due to the layout of struct cfg80211_wowlan_tcp. Its offset is 10 or 12 bytes in the structure depending on the system. 2 and 3. For mac_addr and mac_addr_mask, nl80211_parse_random_mac takes these in as u8* (and hence does not guarantee alignment?) Both the callers of this function today pass in arguments that are explicitly __aligned(2). But this cannot be said of future potential callers - so perhaps my patch introduces a bug? 4. Based on struct cfg80211_acl_data, acl->mac_addrs[i] should be not guaranteed to be __aligned(2). 5. For all the nla_data src arguments, the nla_data function returns ((char*) foo + 5) for pointer foo. So likely not __aligned(2). Based on 3, 4 and 5, this patch should be revoked, but it would be nice to have a confirmation from someone else. ^ permalink raw reply [flat|nested] 24+ messages in thread
* Re: [PATCH v2 03/10] nl80211: Prefer ether_addr_copy 2016-05-30 6:50 ` Kirtika Ruchandani @ 2016-05-31 10:34 ` Johannes Berg 0 siblings, 0 replies; 24+ messages in thread From: Johannes Berg @ 2016-05-31 10:34 UTC (permalink / raw) To: Kirtika Ruchandani, Julian Calaby; +Cc: linux-wireless, Tina Ruchandani, netdev > The requirement is to be __aligned(2). I've added 4 instances of > ether_addr_copy with 8 addresses as arguments. Of these, the 4 > src arguments are really the same type (i.e. nla_data acting on a > const nlattr*), so I'll try to reason about the 5 total cases below - > 1. cfg->dst_mac should be 16-bit aligned due to the layout of > struct cfg80211_wowlan_tcp. Its offset is 10 or 12 bytes in the > structure depending on the system. I wouldn't want to rely on that, since internal structures can be changed pretty easily. If necessary, add __aligned(2) to the struct members where appropriate. > 2 and 3. For mac_addr and mac_addr_mask, nl80211_parse_random_mac > takes these in as u8* (and hence does not guarantee alignment?) > Both the callers of this function today pass in arguments that are > explicitly __aligned(2). But this cannot be said of future potential > callers > - so perhaps my patch introduces a bug? That should be documented, but it's also pretty tricky to review/maintain that. I general, I don't really see much reason to use ether_addr_copy() in any of these code paths - it's not really a performance thing (in part due to the alignment, ether_addr_copy can be faster) > 4. Based on struct cfg80211_acl_data, acl->mac_addrs[i] should be not > guaranteed to be __aligned(2). See above. > 5. For all the nla_data src arguments, the nla_data function returns > ((char*) foo + 5) for pointer foo. So likely not __aligned(2). Those should be aligned since the data is copied into an SKB, and +5 doesn't seem right - nla_data() should be +4. johannes ^ permalink raw reply [flat|nested] 24+ messages in thread
* [PATCH v2 04/10] nl80211: Fix checkpatch.pl warning about braces [not found] ` <cover.1464576022.git.kirtika.ruchandani-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> ` (2 preceding siblings ...) 2016-05-30 2:52 ` [PATCH v2 03/10] nl80211: Prefer ether_addr_copy Kirtika Ruchandani @ 2016-05-30 2:52 ` Kirtika Ruchandani [not found] ` <aef84fd2cf9f2e8fc81b366c83cb38402513f5b1.1464576022.git.kirtika.ruchandani-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> 2016-05-30 2:54 ` [PATCH v2 08/10] nl80211: Fix spelling Kirtika Ruchandani 2016-05-30 2:54 ` [PATCH v2 09/10] nl80211: Fix checkpatch.pl warning Kirtika Ruchandani 5 siblings, 1 reply; 24+ messages in thread From: Kirtika Ruchandani @ 2016-05-30 2:52 UTC (permalink / raw) To: Johannes Berg Cc: linux-wireless-u79uwXL29TY76Z2rM5mHXA, ruchandani.tina-Re5JQEeQqe8AvxtiuMwx3w, netdev-u79uwXL29TY76Z2rM5mHXA, Julian.Calaby-Re5JQEeQqe8AvxtiuMwx3w This patch fixes the following checkpatch,pl warning - - braces {} should be used on all arms of this statement. Signed-off-by: Kirtika Ruchandani <kirtika.ruchandani-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> --- net/wireless/nl80211.c | 23 +++++++++++++++-------- 1 file changed, 15 insertions(+), 8 deletions(-) diff --git a/net/wireless/nl80211.c b/net/wireless/nl80211.c index 34b8fbe..945405d 100644 --- a/net/wireless/nl80211.c +++ b/net/wireless/nl80211.c @@ -870,8 +870,9 @@ nl80211_parse_connkeys(struct cfg80211_registered_device *rdev, result->def = parse.idx; if (!parse.def_uni || !parse.def_multi) goto error; - } else if (parse.defmgmt) + } else if (parse.defmgmt) { goto error; + } err = cfg80211_validate_key_settings(rdev, &parse.p, parse.idx, false, NULL); if (err) @@ -1401,8 +1402,9 @@ static int nl80211_send_wiphy(struct cfg80211_registered_device *rdev, break; case 2: if (nl80211_put_iftypes(msg, NL80211_ATTR_SUPPORTED_IFTYPES, - rdev->wiphy.interface_modes)) - goto nla_put_failure; + rdev->wiphy.interface_modes)) { + goto nla_put_failure; + } state->split_start++; if (state->split) break; @@ -2155,8 +2157,9 @@ static int nl80211_set_wiphy(struct sk_buff *skb, struct genl_info *info) wdev = NULL; netdev = NULL; result = 0; - } else + } else { wdev = netdev->ieee80211_ptr; + } /* end workaround code, by now the rdev is available * and locked, and wdev may or may not be NULL. @@ -3403,8 +3406,9 @@ static int nl80211_start_ap(struct sk_buff *skb, struct genl_info *info) if (!nl80211_valid_auth_type(rdev, params.auth_type, NL80211_CMD_START_AP)) return -EINVAL; - } else + } else { params.auth_type = NL80211_AUTHTYPE_AUTOMATIC; + } err = nl80211_crypto_settings(rdev, info, ¶ms.crypto, NL80211_MAX_NR_CIPHER_SUITES); @@ -3450,8 +3454,9 @@ static int nl80211_start_ap(struct sk_buff *skb, struct genl_info *info) return err; } else if (wdev->preset_chandef.chan) { params.chandef = wdev->preset_chandef; - } else if (!nl80211_get_ap_channel(rdev, ¶ms)) + } else if (!nl80211_get_ap_channel(rdev, ¶ms)) { return -EINVAL; + } if (!cfg80211_reg_can_beacon_relax(&rdev->wiphy, ¶ms.chandef, wdev->iftype)) @@ -7262,8 +7267,9 @@ static int nl80211_crypto_settings(struct cfg80211_registered_device *rdev, return -EINVAL; if (info->attrs[NL80211_ATTR_CONTROL_PORT_NO_ENCRYPT]) settings->control_port_no_encrypt = true; - } else + } else { settings->control_port_ethertype = cpu_to_be16(ETH_P_PAE); + } if (info->attrs[NL80211_ATTR_CIPHER_SUITES_PAIRWISE]) { void *data; @@ -7997,8 +8003,9 @@ static int nl80211_connect(struct sk_buff *skb, struct genl_info *info) if (!nl80211_valid_auth_type(rdev, connect.auth_type, NL80211_CMD_CONNECT)) return -EINVAL; - } else + } else { connect.auth_type = NL80211_AUTHTYPE_AUTOMATIC; + } connect.privacy = info->attrs[NL80211_ATTR_PRIVACY]; -- 2.8.0.rc3.226.g39d4020 -- To unsubscribe from this list: send the line "unsubscribe linux-wireless" in the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org More majordomo info at http://vger.kernel.org/majordomo-info.html ^ permalink raw reply related [flat|nested] 24+ messages in thread
[parent not found: <aef84fd2cf9f2e8fc81b366c83cb38402513f5b1.1464576022.git.kirtika.ruchandani-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>]
* Re: [PATCH v2 04/10] nl80211: Fix checkpatch.pl warning about braces [not found] ` <aef84fd2cf9f2e8fc81b366c83cb38402513f5b1.1464576022.git.kirtika.ruchandani-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> @ 2016-05-30 5:22 ` Julian Calaby 0 siblings, 0 replies; 24+ messages in thread From: Julian Calaby @ 2016-05-30 5:22 UTC (permalink / raw) To: Kirtika Ruchandani; +Cc: Johannes Berg, linux-wireless, Tina Ruchandani, netdev Hi All, On Mon, May 30, 2016 at 12:52 PM, Kirtika Ruchandani <kirtika.ruchandani-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote: > This patch fixes the following checkpatch,pl warning - > - braces {} should be used on all arms of this statement. > > Signed-off-by: Kirtika Ruchandani <kirtika.ruchandani-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> Looks right to me. Reviewed-by: Julian Calaby <julian.calaby-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> Thanks, Julian Calaby > --- > net/wireless/nl80211.c | 23 +++++++++++++++-------- > 1 file changed, 15 insertions(+), 8 deletions(-) > > diff --git a/net/wireless/nl80211.c b/net/wireless/nl80211.c > index 34b8fbe..945405d 100644 > --- a/net/wireless/nl80211.c > +++ b/net/wireless/nl80211.c > @@ -870,8 +870,9 @@ nl80211_parse_connkeys(struct cfg80211_registered_device *rdev, > result->def = parse.idx; > if (!parse.def_uni || !parse.def_multi) > goto error; > - } else if (parse.defmgmt) > + } else if (parse.defmgmt) { > goto error; > + } > err = cfg80211_validate_key_settings(rdev, &parse.p, > parse.idx, false, NULL); > if (err) > @@ -1401,8 +1402,9 @@ static int nl80211_send_wiphy(struct cfg80211_registered_device *rdev, > break; > case 2: > if (nl80211_put_iftypes(msg, NL80211_ATTR_SUPPORTED_IFTYPES, > - rdev->wiphy.interface_modes)) > - goto nla_put_failure; > + rdev->wiphy.interface_modes)) { > + goto nla_put_failure; > + } > state->split_start++; > if (state->split) > break; > @@ -2155,8 +2157,9 @@ static int nl80211_set_wiphy(struct sk_buff *skb, struct genl_info *info) > wdev = NULL; > netdev = NULL; > result = 0; > - } else > + } else { > wdev = netdev->ieee80211_ptr; > + } > > /* end workaround code, by now the rdev is available > * and locked, and wdev may or may not be NULL. > @@ -3403,8 +3406,9 @@ static int nl80211_start_ap(struct sk_buff *skb, struct genl_info *info) > if (!nl80211_valid_auth_type(rdev, params.auth_type, > NL80211_CMD_START_AP)) > return -EINVAL; > - } else > + } else { > params.auth_type = NL80211_AUTHTYPE_AUTOMATIC; > + } > > err = nl80211_crypto_settings(rdev, info, ¶ms.crypto, > NL80211_MAX_NR_CIPHER_SUITES); > @@ -3450,8 +3454,9 @@ static int nl80211_start_ap(struct sk_buff *skb, struct genl_info *info) > return err; > } else if (wdev->preset_chandef.chan) { > params.chandef = wdev->preset_chandef; > - } else if (!nl80211_get_ap_channel(rdev, ¶ms)) > + } else if (!nl80211_get_ap_channel(rdev, ¶ms)) { > return -EINVAL; > + } > > if (!cfg80211_reg_can_beacon_relax(&rdev->wiphy, ¶ms.chandef, > wdev->iftype)) > @@ -7262,8 +7267,9 @@ static int nl80211_crypto_settings(struct cfg80211_registered_device *rdev, > return -EINVAL; > if (info->attrs[NL80211_ATTR_CONTROL_PORT_NO_ENCRYPT]) > settings->control_port_no_encrypt = true; > - } else > + } else { > settings->control_port_ethertype = cpu_to_be16(ETH_P_PAE); > + } > > if (info->attrs[NL80211_ATTR_CIPHER_SUITES_PAIRWISE]) { > void *data; > @@ -7997,8 +8003,9 @@ static int nl80211_connect(struct sk_buff *skb, struct genl_info *info) > if (!nl80211_valid_auth_type(rdev, connect.auth_type, > NL80211_CMD_CONNECT)) > return -EINVAL; > - } else > + } else { > connect.auth_type = NL80211_AUTHTYPE_AUTOMATIC; > + } > > connect.privacy = info->attrs[NL80211_ATTR_PRIVACY]; > > -- > 2.8.0.rc3.226.g39d4020 > -- Julian Calaby Email: julian.calaby-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org Profile: http://www.google.com/profiles/julian.calaby/ -- To unsubscribe from this list: send the line "unsubscribe linux-wireless" in the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org More majordomo info at http://vger.kernel.org/majordomo-info.html ^ permalink raw reply [flat|nested] 24+ messages in thread
* [PATCH v2 08/10] nl80211: Fix spelling [not found] ` <cover.1464576022.git.kirtika.ruchandani-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> ` (3 preceding siblings ...) 2016-05-30 2:52 ` [PATCH v2 04/10] nl80211: Fix checkpatch.pl warning about braces Kirtika Ruchandani @ 2016-05-30 2:54 ` Kirtika Ruchandani 2016-05-30 5:31 ` Julian Calaby 2016-05-30 2:54 ` [PATCH v2 09/10] nl80211: Fix checkpatch.pl warning Kirtika Ruchandani 5 siblings, 1 reply; 24+ messages in thread From: Kirtika Ruchandani @ 2016-05-30 2:54 UTC (permalink / raw) To: Johannes Berg Cc: linux-wireless-u79uwXL29TY76Z2rM5mHXA, ruchandani.tina-Re5JQEeQqe8AvxtiuMwx3w, netdev-u79uwXL29TY76Z2rM5mHXA, Julian.Calaby-Re5JQEeQqe8AvxtiuMwx3w Fix 'implementation' spelling, reported by checkpatch.pl Signed-off-by: Kirtika Ruchandani <kirtika.ruchandani-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> --- net/wireless/nl80211.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/net/wireless/nl80211.c b/net/wireless/nl80211.c index 6f8e2a7..c6d870e 100644 --- a/net/wireless/nl80211.c +++ b/net/wireless/nl80211.c @@ -6492,7 +6492,7 @@ nl80211_parse_sched_scan(struct wiphy *wiphy, struct wireless_dev *wdev, nla_data(ssid), nla_len(ssid)); request->match_sets[i].ssid.ssid_len = nla_len(ssid); - /* special attribute - old implemenation w/a */ + /* special attribute - old implementation w/a */ request->match_sets[i].rssi_thold = default_match_rssi; rssi = tb[NL80211_SCHED_SCAN_MATCH_ATTR_RSSI]; -- 2.8.0.rc3.226.g39d4020 -- To unsubscribe from this list: send the line "unsubscribe linux-wireless" in the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org More majordomo info at http://vger.kernel.org/majordomo-info.html ^ permalink raw reply related [flat|nested] 24+ messages in thread
* Re: [PATCH v2 08/10] nl80211: Fix spelling 2016-05-30 2:54 ` [PATCH v2 08/10] nl80211: Fix spelling Kirtika Ruchandani @ 2016-05-30 5:31 ` Julian Calaby 0 siblings, 0 replies; 24+ messages in thread From: Julian Calaby @ 2016-05-30 5:31 UTC (permalink / raw) To: Kirtika Ruchandani; +Cc: Johannes Berg, linux-wireless, Tina Ruchandani, netdev Hi All, On Mon, May 30, 2016 at 12:54 PM, Kirtika Ruchandani <kirtika.ruchandani@gmail.com> wrote: > Fix 'implementation' spelling, reported by checkpatch.pl > > Signed-off-by: Kirtika Ruchandani <kirtika.ruchandani@gmail.com> Looks right to me. Reviewed-by: Julian Calaby <julian.calaby@gmail.com> Thanks, Julian Calaby > --- > net/wireless/nl80211.c | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) > > diff --git a/net/wireless/nl80211.c b/net/wireless/nl80211.c > index 6f8e2a7..c6d870e 100644 > --- a/net/wireless/nl80211.c > +++ b/net/wireless/nl80211.c > @@ -6492,7 +6492,7 @@ nl80211_parse_sched_scan(struct wiphy *wiphy, struct wireless_dev *wdev, > nla_data(ssid), nla_len(ssid)); > request->match_sets[i].ssid.ssid_len = > nla_len(ssid); > - /* special attribute - old implemenation w/a */ > + /* special attribute - old implementation w/a */ > request->match_sets[i].rssi_thold = > default_match_rssi; > rssi = tb[NL80211_SCHED_SCAN_MATCH_ATTR_RSSI]; > -- > 2.8.0.rc3.226.g39d4020 > -- Julian Calaby Email: julian.calaby@gmail.com Profile: http://www.google.com/profiles/julian.calaby/ ^ permalink raw reply [flat|nested] 24+ messages in thread
* [PATCH v2 09/10] nl80211: Fix checkpatch.pl warning [not found] ` <cover.1464576022.git.kirtika.ruchandani-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> ` (4 preceding siblings ...) 2016-05-30 2:54 ` [PATCH v2 08/10] nl80211: Fix spelling Kirtika Ruchandani @ 2016-05-30 2:54 ` Kirtika Ruchandani [not found] ` <2b42b54b8128bb953569021ddadce77499859a79.1464576022.git.kirtika.ruchandani-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> 5 siblings, 1 reply; 24+ messages in thread From: Kirtika Ruchandani @ 2016-05-30 2:54 UTC (permalink / raw) To: Johannes Berg Cc: linux-wireless-u79uwXL29TY76Z2rM5mHXA, ruchandani.tina-Re5JQEeQqe8AvxtiuMwx3w, netdev-u79uwXL29TY76Z2rM5mHXA, Julian.Calaby-Re5JQEeQqe8AvxtiuMwx3w This patch fixes the checkpatch.pl warning "foo * bar should be foo *bar" Signed-off-by: Kirtika Ruchandani <kirtika.ruchandani-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> --- net/wireless/nl80211.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/net/wireless/nl80211.c b/net/wireless/nl80211.c index c6d870e..46757af 100644 --- a/net/wireless/nl80211.c +++ b/net/wireless/nl80211.c @@ -12214,7 +12214,7 @@ void nl80211_send_ibss_bssid(struct cfg80211_registered_device *rdev, } void cfg80211_notify_new_peer_candidate(struct net_device *dev, const u8 *addr, - const u8* ie, u8 ie_len, gfp_t gfp) + const u8 *ie, u8 ie_len, gfp_t gfp) { struct wireless_dev *wdev = dev->ieee80211_ptr; struct cfg80211_registered_device *rdev = wiphy_to_rdev(wdev->wiphy); @@ -13362,7 +13362,7 @@ void cfg80211_tdls_oper_request(struct net_device *dev, const u8 *peer, } EXPORT_SYMBOL(cfg80211_tdls_oper_request); -static int nl80211_netlink_notify(struct notifier_block * nb, +static int nl80211_netlink_notify(struct notifier_block *nb, unsigned long state, void *_notify) { -- 2.8.0.rc3.226.g39d4020 -- To unsubscribe from this list: send the line "unsubscribe linux-wireless" in the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org More majordomo info at http://vger.kernel.org/majordomo-info.html ^ permalink raw reply related [flat|nested] 24+ messages in thread
[parent not found: <2b42b54b8128bb953569021ddadce77499859a79.1464576022.git.kirtika.ruchandani-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>]
* Re: [PATCH v2 09/10] nl80211: Fix checkpatch.pl warning [not found] ` <2b42b54b8128bb953569021ddadce77499859a79.1464576022.git.kirtika.ruchandani-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> @ 2016-05-30 5:31 ` Julian Calaby 0 siblings, 0 replies; 24+ messages in thread From: Julian Calaby @ 2016-05-30 5:31 UTC (permalink / raw) To: Kirtika Ruchandani; +Cc: Johannes Berg, linux-wireless, Tina Ruchandani, netdev Hi All, On Mon, May 30, 2016 at 12:54 PM, Kirtika Ruchandani <kirtika.ruchandani-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote: > This patch fixes the checkpatch.pl warning "foo * bar should be > foo *bar" > > Signed-off-by: Kirtika Ruchandani <kirtika.ruchandani-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> Looks right to me. Reviewed-by: Julian Calaby <julian.calaby-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> Thanks, Julian Calaby > --- > net/wireless/nl80211.c | 4 ++-- > 1 file changed, 2 insertions(+), 2 deletions(-) > > diff --git a/net/wireless/nl80211.c b/net/wireless/nl80211.c > index c6d870e..46757af 100644 > --- a/net/wireless/nl80211.c > +++ b/net/wireless/nl80211.c > @@ -12214,7 +12214,7 @@ void nl80211_send_ibss_bssid(struct cfg80211_registered_device *rdev, > } > > void cfg80211_notify_new_peer_candidate(struct net_device *dev, const u8 *addr, > - const u8* ie, u8 ie_len, gfp_t gfp) > + const u8 *ie, u8 ie_len, gfp_t gfp) > { > struct wireless_dev *wdev = dev->ieee80211_ptr; > struct cfg80211_registered_device *rdev = wiphy_to_rdev(wdev->wiphy); > @@ -13362,7 +13362,7 @@ void cfg80211_tdls_oper_request(struct net_device *dev, const u8 *peer, > } > EXPORT_SYMBOL(cfg80211_tdls_oper_request); > > -static int nl80211_netlink_notify(struct notifier_block * nb, > +static int nl80211_netlink_notify(struct notifier_block *nb, > unsigned long state, > void *_notify) > { > -- > 2.8.0.rc3.226.g39d4020 > -- Julian Calaby Email: julian.calaby-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org Profile: http://www.google.com/profiles/julian.calaby/ -- To unsubscribe from this list: send the line "unsubscribe linux-wireless" in the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org More majordomo info at http://vger.kernel.org/majordomo-info.html ^ permalink raw reply [flat|nested] 24+ messages in thread
* [PATCH v2 05/10] nl80211: Fix checkpatch.pl NULL comparison warning 2016-05-30 2:49 [PATCH v2 00/10] nl80211: Fix checkpatch.pl issues Kirtika Ruchandani [not found] ` <cover.1464576022.git.kirtika.ruchandani-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> @ 2016-05-30 2:52 ` Kirtika Ruchandani 2016-05-30 5:22 ` Julian Calaby 2016-05-30 2:53 ` [PATCH v2 06/10] nl80211: Various checkpatch.pl spacing fixes Kirtika Ruchandani ` (2 subsequent siblings) 4 siblings, 1 reply; 24+ messages in thread From: Kirtika Ruchandani @ 2016-05-30 2:52 UTC (permalink / raw) To: Johannes Berg; +Cc: linux-wireless, ruchandani.tina, netdev, Julian.Calaby This patch fixes the warning - "comparison to NULL (foo == NULL) could be written as (!foo)" Signed-off-by: Kirtika Ruchandani <kirtika.ruchandani@gmail.com> --- net/wireless/nl80211.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/net/wireless/nl80211.c b/net/wireless/nl80211.c index 945405d..11cbf0b 100644 --- a/net/wireless/nl80211.c +++ b/net/wireless/nl80211.c @@ -928,7 +928,7 @@ static struct ieee80211_channel *nl80211_get_valid_chan(struct wiphy *wiphy, { struct ieee80211_channel *chan; - if (tb == NULL) + if (!tb) return NULL; chan = ieee80211_get_channel(wiphy, nla_get_u32(tb)); if (!chan || chan->flags & IEEE80211_CHAN_DISABLED) @@ -8575,7 +8575,7 @@ static int nl80211_set_tx_bitrate_mask(struct sk_buff *skb, if (band < 0 || band >= NUM_NL80211_BANDS) return -EINVAL; sband = rdev->wiphy.bands[band]; - if (sband == NULL) + if (!sband) return -EINVAL; err = nla_parse(tb, NL80211_TXRATE_MAX, nla_data(tx_rates), nla_len(tx_rates), nl80211_txattr_policy); ^ permalink raw reply related [flat|nested] 24+ messages in thread
* Re: [PATCH v2 05/10] nl80211: Fix checkpatch.pl NULL comparison warning 2016-05-30 2:52 ` [PATCH v2 05/10] nl80211: Fix checkpatch.pl NULL comparison warning Kirtika Ruchandani @ 2016-05-30 5:22 ` Julian Calaby 0 siblings, 0 replies; 24+ messages in thread From: Julian Calaby @ 2016-05-30 5:22 UTC (permalink / raw) To: Kirtika Ruchandani; +Cc: Johannes Berg, linux-wireless, Tina Ruchandani, netdev Hi All, On Mon, May 30, 2016 at 12:52 PM, Kirtika Ruchandani <kirtika.ruchandani@gmail.com> wrote: > This patch fixes the warning - "comparison to NULL (foo == NULL) > could be written as (!foo)" > > Signed-off-by: Kirtika Ruchandani <kirtika.ruchandani@gmail.com> Looks right to me. Reviewed-by: Julian Calaby <julian.calaby@gmail.com> Thanks, Julian Calaby > --- > net/wireless/nl80211.c | 4 ++-- > 1 file changed, 2 insertions(+), 2 deletions(-) > > diff --git a/net/wireless/nl80211.c b/net/wireless/nl80211.c > index 945405d..11cbf0b 100644 > --- a/net/wireless/nl80211.c > +++ b/net/wireless/nl80211.c > @@ -928,7 +928,7 @@ static struct ieee80211_channel *nl80211_get_valid_chan(struct wiphy *wiphy, > { > struct ieee80211_channel *chan; > > - if (tb == NULL) > + if (!tb) > return NULL; > chan = ieee80211_get_channel(wiphy, nla_get_u32(tb)); > if (!chan || chan->flags & IEEE80211_CHAN_DISABLED) > @@ -8575,7 +8575,7 @@ static int nl80211_set_tx_bitrate_mask(struct sk_buff *skb, > if (band < 0 || band >= NUM_NL80211_BANDS) > return -EINVAL; > sband = rdev->wiphy.bands[band]; > - if (sband == NULL) > + if (!sband) > return -EINVAL; > err = nla_parse(tb, NL80211_TXRATE_MAX, nla_data(tx_rates), > nla_len(tx_rates), nl80211_txattr_policy); > -- > 2.8.0.rc3.226.g39d4020 > -- Julian Calaby Email: julian.calaby@gmail.com Profile: http://www.google.com/profiles/julian.calaby/ ^ permalink raw reply [flat|nested] 24+ messages in thread
* [PATCH v2 06/10] nl80211: Various checkpatch.pl spacing fixes 2016-05-30 2:49 [PATCH v2 00/10] nl80211: Fix checkpatch.pl issues Kirtika Ruchandani [not found] ` <cover.1464576022.git.kirtika.ruchandani-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> 2016-05-30 2:52 ` [PATCH v2 05/10] nl80211: Fix checkpatch.pl NULL comparison warning Kirtika Ruchandani @ 2016-05-30 2:53 ` Kirtika Ruchandani 2016-05-30 5:25 ` Julian Calaby 2016-05-30 6:07 ` Julian Calaby 2016-05-30 2:53 ` [PATCH v2 07/10] nl80211: Avoid multiple assignments on same line Kirtika Ruchandani 2016-05-30 2:54 ` [PATCH v2 10/10] nl80211: Prefer kcalloc over kzalloc Kirtika Ruchandani 4 siblings, 2 replies; 24+ messages in thread From: Kirtika Ruchandani @ 2016-05-30 2:53 UTC (permalink / raw) To: Johannes Berg; +Cc: linux-wireless, ruchandani.tina, netdev, Julian.Calaby This patch fixes the following spacing issues reported by checkpatch.pl - - space preferred around that <operator> - no space needed after cast. - Alignment should match open parenthesis - suspect code indent for conditional statements - Statements should start on a tabstop This patch also contains two hunks to fix 'line over 80 characters', that are spacing related. All other instances of that warning have been ignored. Signed-off-by: Kirtika Ruchandani <kirtika.ruchandani@gmail.com> --- net/wireless/nl80211.c | 103 ++++++++++++++++++++++++++----------------------- 1 file changed, 54 insertions(+), 49 deletions(-) diff --git a/net/wireless/nl80211.c b/net/wireless/nl80211.c index 11cbf0b..ad7cdce 100644 --- a/net/wireless/nl80211.c +++ b/net/wireless/nl80211.c @@ -39,10 +39,10 @@ static void nl80211_post_doit(const struct genl_ops *ops, struct sk_buff *skb, /* the netlink family */ static struct genl_family nl80211_fam = { - .id = GENL_ID_GENERATE, /* don't bother with a hardcoded ID */ - .name = NL80211_GENL_NAME, /* have users key off the name instead */ - .hdrsize = 0, /* no private header */ - .version = 1, /* no particular meaning now */ + .id = GENL_ID_GENERATE, /* don't bother with a hardcoded ID */ + .name = NL80211_GENL_NAME, /* have users key off the name instead */ + .hdrsize = 0, /* no private header */ + .version = 1, /* no particular meaning now */ .maxattr = NL80211_ATTR_MAX, .netnsok = true, .pre_doit = nl80211_pre_doit, @@ -213,7 +213,7 @@ cfg80211_get_dev_from_info(struct net *netns, struct genl_info *info) static const struct nla_policy nl80211_policy[NUM_NL80211_ATTR] = { [NL80211_ATTR_WIPHY] = { .type = NLA_U32 }, [NL80211_ATTR_WIPHY_NAME] = { .type = NLA_NUL_STRING, - .len = 20-1 }, + .len = 20 - 1 }, [NL80211_ATTR_WIPHY_TXQ_PARAMS] = { .type = NLA_NESTED }, [NL80211_ATTR_WIPHY_FREQ] = { .type = NLA_U32 }, @@ -231,7 +231,7 @@ static const struct nla_policy nl80211_policy[NUM_NL80211_ATTR] = { [NL80211_ATTR_IFTYPE] = { .type = NLA_U32 }, [NL80211_ATTR_IFINDEX] = { .type = NLA_U32 }, - [NL80211_ATTR_IFNAME] = { .type = NLA_NUL_STRING, .len = IFNAMSIZ-1 }, + [NL80211_ATTR_IFNAME] = { .type = NLA_NUL_STRING, .len = IFNAMSIZ - 1 }, [NL80211_ATTR_MAC] = { .len = ETH_ALEN }, [NL80211_ATTR_PREV_BSSID] = { .len = ETH_ALEN }, @@ -967,7 +967,7 @@ static int nl80211_put_iface_combinations(struct wiphy *wiphy, int i, j; nl_combis = nla_nest_start(msg, - NL80211_ATTR_INTERFACE_COMBINATIONS); + NL80211_ATTR_INTERFACE_COMBINATIONS); if (!nl_combis) goto nla_put_failure; @@ -1012,9 +1012,9 @@ static int nl80211_put_iface_combinations(struct wiphy *wiphy, goto nla_put_failure; if (large && (nla_put_u32(msg, NL80211_IFACE_COMB_RADAR_DETECT_WIDTHS, - c->radar_detect_widths) || + c->radar_detect_widths) || nla_put_u32(msg, NL80211_IFACE_COMB_RADAR_DETECT_REGIONS, - c->radar_detect_regions))) + c->radar_detect_regions))) goto nla_put_failure; nla_nest_end(msg, nl_combi); @@ -1493,7 +1493,7 @@ static int nl80211_send_wiphy(struct cfg80211_registered_device *rdev, i = 0; #define CMD(op, n) \ - do { \ + do { \ if (rdev->ops->op) { \ i++; \ if (nla_put_u32(msg, i, NL80211_CMD_ ## n)) \ @@ -1735,8 +1735,9 @@ static int nl80211_send_wiphy(struct cfg80211_registered_device *rdev, rdev->wiphy.max_num_csa_counters)) goto nla_put_failure; - if (rdev->wiphy.regulatory_flags & REGULATORY_WIPHY_SELF_MANAGED && - nla_put_flag(msg, NL80211_ATTR_WIPHY_SELF_MANAGED_REG)) + if ((rdev->wiphy.regulatory_flags & + REGULATORY_WIPHY_SELF_MANAGED) && + nla_put_flag(msg, NL80211_ATTR_WIPHY_SELF_MANAGED_REG)) goto nla_put_failure; if (nla_put(msg, NL80211_ATTR_EXT_FEATURES, @@ -2299,7 +2300,7 @@ static int nl80211_set_wiphy(struct sk_buff *skb, struct genl_info *info) if (frag_threshold < 256) return -EINVAL; - if (frag_threshold != (u32) -1) { + if (frag_threshold != (u32)-1) { /* Fragments (apart from the last one) are required to * have even length. Make the fragmentation code * simpler by stripping LSB should someone try to use @@ -2406,7 +2407,8 @@ static int nl80211_send_chandef(struct sk_buff *msg, return 0; } -static int nl80211_send_iface(struct sk_buff *msg, u32 portid, u32 seq, int flags, +static int nl80211_send_iface(struct sk_buff *msg, + u32 portid, u32 seq, int flags, struct cfg80211_registered_device *rdev, struct wireless_dev *wdev, bool removal) { @@ -2470,7 +2472,8 @@ static int nl80211_send_iface(struct sk_buff *msg, u32 portid, u32 seq, int flag return -EMSGSIZE; } -static int nl80211_dump_interface(struct sk_buff *skb, struct netlink_callback *cb) +static int nl80211_dump_interface(struct sk_buff *skb, + struct netlink_callback *cb) { int wp_idx = 0; int if_idx = 0; @@ -2557,7 +2560,7 @@ static int parse_monitor_flags(struct nlattr *nla, u32 *mntrflags) for (flag = 1; flag <= NL80211_MNTR_FLAG_MAX; flag++) if (flags[flag]) - *mntrflags |= (1<<flag); + *mntrflags |= (1 << flag); return 0; } @@ -2722,9 +2725,9 @@ static int nl80211_new_interface(struct sk_buff *skb, struct genl_info *info) return -ENOMEM; wdev = rdev_add_virtual_intf(rdev, - nla_data(info->attrs[NL80211_ATTR_IFNAME]), - NET_NAME_USER, type, err ? NULL : &flags, - ¶ms); + nla_data(info->attrs[NL80211_ATTR_IFNAME]), + NET_NAME_USER, type, err ? NULL : &flags, + ¶ms); if (WARN_ON(!wdev)) { nlmsg_free(msg); return -EPROTO; @@ -3000,7 +3003,7 @@ static int nl80211_set_key(struct sk_buff *skb, struct genl_info *info) goto out; err = rdev_set_default_key(rdev, dev, key.idx, - key.def_uni, key.def_multi); + key.def_uni, key.def_multi); if (err) goto out; @@ -3621,7 +3624,7 @@ static int parse_station_flags(struct genl_info *info, for (flag = 1; flag <= NL80211_STA_FLAG_MAX; flag++) { if (flags[flag]) { - params->sta_flags_set |= (1<<flag); + params->sta_flags_set |= (1 << flag); /* no longer support new API additions in old API */ if (flag > NL80211_STA_FLAG_MAX_OLD_API) @@ -3949,10 +3952,10 @@ static int nl80211_dump_station(struct sk_buff *skb, goto out_err; if (nl80211_send_station(skb, NL80211_CMD_NEW_STATION, - NETLINK_CB(cb->skb).portid, - cb->nlh->nlmsg_seq, NLM_F_MULTI, - rdev, wdev->netdev, mac_addr, - &sinfo) < 0) + NETLINK_CB(cb->skb).portid, + cb->nlh->nlmsg_seq, NLM_F_MULTI, + rdev, wdev->netdev, mac_addr, + &sinfo) < 0) goto out; sta_idx++; @@ -4224,7 +4227,7 @@ static int nl80211_parse_sta_wme(struct genl_info *info, } static int nl80211_parse_sta_channel_info(struct genl_info *info, - struct station_parameters *params) + struct station_parameters *params) { if (info->attrs[NL80211_ATTR_STA_SUPPORTED_CHANNELS]) { params->supported_channels = @@ -4655,9 +4658,9 @@ static int nl80211_del_station(struct sk_buff *skb, struct genl_info *info) } static int nl80211_send_mpath(struct sk_buff *msg, u32 portid, u32 seq, - int flags, struct net_device *dev, - u8 *dst, u8 *next_hop, - struct mpath_info *pinfo) + int flags, struct net_device *dev, + u8 *dst, u8 *next_hop, + struct mpath_info *pinfo) { void *hdr; struct nlattr *pinfoattr; @@ -4790,7 +4793,7 @@ static int nl80211_get_mpath(struct sk_buff *skb, struct genl_info *info) return -ENOMEM; if (nl80211_send_mpath(msg, info->snd_portid, info->snd_seq, 0, - dev, dst, next_hop, &pinfo) < 0) { + dev, dst, next_hop, &pinfo) < 0) { nlmsg_free(msg); return -ENOBUFS; } @@ -5185,7 +5188,8 @@ static int nl80211_get_mesh_config(struct sk_buff *skb, return -ENOBUFS; } -static const struct nla_policy nl80211_meshconf_params_policy[NL80211_MESHCONF_ATTR_MAX+1] = { +static const +struct nla_policy nl80211_meshconf_params_policy[NL80211_MESHCONF_ATTR_MAX + 1] = { [NL80211_MESHCONF_RETRY_TIMEOUT] = { .type = NLA_U16 }, [NL80211_MESHCONF_CONFIRM_TIMEOUT] = { .type = NLA_U16 }, [NL80211_MESHCONF_HOLDING_TIMEOUT] = { .type = NLA_U16 }, @@ -5217,7 +5221,7 @@ static const struct nla_policy nl80211_meshconf_params_policy[NL80211_MESHCONF_A }; static const struct nla_policy - nl80211_mesh_setup_params_policy[NL80211_MESH_SETUP_ATTR_MAX+1] = { + nl80211_mesh_setup_params_policy[NL80211_MESH_SETUP_ATTR_MAX + 1] = { [NL80211_MESH_SETUP_ENABLE_VENDOR_SYNC] = { .type = NLA_U8 }, [NL80211_MESH_SETUP_ENABLE_VENDOR_PATH_SEL] = { .type = NLA_U8 }, [NL80211_MESH_SETUP_ENABLE_VENDOR_METRIC] = { .type = NLA_U8 }, @@ -5363,7 +5367,7 @@ do { \ } static int nl80211_parse_mesh_setup(struct genl_info *info, - struct mesh_setup *setup) + struct mesh_setup *setup) { struct cfg80211_registered_device *rdev = info->user_ptr[0]; struct nlattr *tb[NL80211_MESH_SETUP_ATTR_MAX + 1]; @@ -5672,7 +5676,7 @@ static const struct nla_policy reg_rule_policy[NL80211_REG_RULE_ATTR_MAX + 1] = }; static int parse_reg_rule(struct nlattr *tb[], - struct ieee80211_reg_rule *reg_rule) + struct ieee80211_reg_rule *reg_rule) { struct ieee80211_freq_range *freq_range = ®_rule->freq_range; struct ieee80211_power_rule *power_rule = ®_rule->power_rule; @@ -6686,7 +6690,7 @@ static int nl80211_channel_switch(struct sk_buff *skb, struct genl_info *info) /* csa_attrs is defined static to avoid waste of stack size - this * function is called under RTNL lock, so this should not be a problem. */ - static struct nlattr *csa_attrs[NL80211_ATTR_MAX+1]; + static struct nlattr *csa_attrs[NL80211_ATTR_MAX + 1]; int err; bool need_new_beacon = false; int len, i; @@ -6982,8 +6986,8 @@ static int nl80211_dump_scan(struct sk_buff *skb, struct netlink_callback *cb) if (++idx <= start) continue; if (nl80211_send_bss(skb, cb, - cb->nlh->nlmsg_seq, NLM_F_MULTI, - rdev, wdev, scan) < 0) { + cb->nlh->nlmsg_seq, NLM_F_MULTI, + rdev, wdev, scan) < 0) { idx--; break; } @@ -7035,7 +7039,7 @@ static int nl80211_send_survey(struct sk_buff *msg, u32 portid, u32 seq, goto nla_put_failure; if ((survey->filled & SURVEY_INFO_TIME) && nla_put_u64_64bit(msg, NL80211_SURVEY_INFO_TIME, - survey->time, NL80211_SURVEY_INFO_PAD)) + survey->time, NL80211_SURVEY_INFO_PAD)) goto nla_put_failure; if ((survey->filled & SURVEY_INFO_TIME_BUSY) && nla_put_u64_64bit(msg, NL80211_SURVEY_INFO_TIME_BUSY, @@ -7109,9 +7113,9 @@ static int nl80211_dump_survey(struct sk_buff *skb, struct netlink_callback *cb) } if (nl80211_send_survey(skb, - NETLINK_CB(cb->skb).portid, - cb->nlh->nlmsg_seq, NLM_F_MULTI, - wdev->netdev, radio_stats, &survey) < 0) + NETLINK_CB(cb->skb).portid, + cb->nlh->nlmsg_seq, NLM_F_MULTI, + wdev->netdev, radio_stats, &survey) < 0) goto out; survey_idx++; } @@ -7674,8 +7678,8 @@ static int nl80211_join_ibss(struct sk_buff *skb, struct genl_info *info) bool no_ht = false; connkeys = nl80211_parse_connkeys(rdev, - info->attrs[NL80211_ATTR_KEYS], - &no_ht); + info->attrs[NL80211_ATTR_KEYS], + &no_ht); if (IS_ERR(connkeys)) return PTR_ERR(connkeys); @@ -8022,7 +8026,7 @@ static int nl80211_connect(struct sk_buff *skb, struct genl_info *info) connect.bg_scan_period = -1; if (info->attrs[NL80211_ATTR_BG_SCAN_PERIOD] && - (wiphy->flags & WIPHY_FLAG_SUPPORTS_FW_ROAM)) { + (wiphy->flags & WIPHY_FLAG_SUPPORTS_FW_ROAM)) { connect.bg_scan_period = nla_get_u16(info->attrs[NL80211_ATTR_BG_SCAN_PERIOD]); } @@ -8067,7 +8071,8 @@ static int nl80211_connect(struct sk_buff *skb, struct genl_info *info) if (connect.privacy && info->attrs[NL80211_ATTR_KEYS]) { connkeys = nl80211_parse_connkeys(rdev, - info->attrs[NL80211_ATTR_KEYS], NULL); + info->attrs[NL80211_ATTR_KEYS], + NULL); if (IS_ERR(connkeys)) return PTR_ERR(connkeys); } @@ -9046,7 +9051,7 @@ static int nl80211_join_mesh(struct sk_buff *skb, struct genl_info *info) if (info->attrs[NL80211_ATTR_MCAST_RATE] && !nl80211_parse_mcast_rate(rdev, setup.mcast_rate, nla_get_u32(info->attrs[NL80211_ATTR_MCAST_RATE]))) - return -EINVAL; + return -EINVAL; if (info->attrs[NL80211_ATTR_BEACON_INTERVAL]) { setup.beacon_interval = @@ -12234,7 +12239,7 @@ void cfg80211_notify_new_peer_candidate(struct net_device *dev, const u8 *addr, nla_put_u32(msg, NL80211_ATTR_IFINDEX, dev->ifindex) || nla_put(msg, NL80211_ATTR_MAC, ETH_ALEN, addr) || (ie_len && ie && - nla_put(msg, NL80211_ATTR_IE, ie_len , ie))) + nla_put(msg, NL80211_ATTR_IE, ie_len, ie))) goto nla_put_failure; genlmsg_end(msg, hdr); @@ -12958,7 +12963,7 @@ static void nl80211_ch_switch_notify(struct cfg80211_registered_device *rdev, if ((notif == NL80211_CMD_CH_SWITCH_STARTED_NOTIFY) && (nla_put_u32(msg, NL80211_ATTR_CH_SWITCH_COUNT, count))) - goto nla_put_failure; + goto nla_put_failure; genlmsg_end(msg, hdr); @@ -13297,7 +13302,7 @@ void cfg80211_report_wowlan_wakeup(struct wireless_dev *wdev, if (wakeup->net_detect && cfg80211_net_detect_results(msg, wakeup)) - goto free_msg; + goto free_msg; nla_nest_end(msg, reasons); } ^ permalink raw reply related [flat|nested] 24+ messages in thread
* Re: [PATCH v2 06/10] nl80211: Various checkpatch.pl spacing fixes 2016-05-30 2:53 ` [PATCH v2 06/10] nl80211: Various checkpatch.pl spacing fixes Kirtika Ruchandani @ 2016-05-30 5:25 ` Julian Calaby 2016-05-30 6:04 ` Kirtika Ruchandani 2016-05-30 6:07 ` Julian Calaby 1 sibling, 1 reply; 24+ messages in thread From: Julian Calaby @ 2016-05-30 5:25 UTC (permalink / raw) To: Kirtika Ruchandani; +Cc: Johannes Berg, linux-wireless, Tina Ruchandani, netdev Hi All, On Mon, May 30, 2016 at 12:53 PM, Kirtika Ruchandani <kirtika.ruchandani@gmail.com> wrote: > This patch fixes the following spacing issues reported > by checkpatch.pl - > - space preferred around that <operator> > - no space needed after cast. > - Alignment should match open parenthesis > - suspect code indent for conditional statements > - Statements should start on a tabstop > > This patch also contains two hunks to fix 'line over 80 characters', > that are spacing related. > All other instances of that warning have been ignored. > > Signed-off-by: Kirtika Ruchandani <kirtika.ruchandani@gmail.com> Looks right to me except for one minor point: > --- > net/wireless/nl80211.c | 103 ++++++++++++++++++++++++++----------------------- > 1 file changed, 54 insertions(+), 49 deletions(-) > > diff --git a/net/wireless/nl80211.c b/net/wireless/nl80211.c > index 11cbf0b..ad7cdce 100644 > --- a/net/wireless/nl80211.c > +++ b/net/wireless/nl80211.c > @@ -1735,8 +1735,9 @@ static int nl80211_send_wiphy(struct cfg80211_registered_device *rdev, > rdev->wiphy.max_num_csa_counters)) > goto nla_put_failure; > > - if (rdev->wiphy.regulatory_flags & REGULATORY_WIPHY_SELF_MANAGED && > - nla_put_flag(msg, NL80211_ATTR_WIPHY_SELF_MANAGED_REG)) > + if ((rdev->wiphy.regulatory_flags & > + REGULATORY_WIPHY_SELF_MANAGED) && > + nla_put_flag(msg, NL80211_ATTR_WIPHY_SELF_MANAGED_REG)) Adding the brackets around the & expression doesn't look spacing related to me. What's the exact warning this is fixing? > goto nla_put_failure; > > if (nla_put(msg, NL80211_ATTR_EXT_FEATURES, Thanks, -- Julian Calaby Email: julian.calaby@gmail.com Profile: http://www.google.com/profiles/julian.calaby/ ^ permalink raw reply [flat|nested] 24+ messages in thread
* Re: [PATCH v2 06/10] nl80211: Various checkpatch.pl spacing fixes 2016-05-30 5:25 ` Julian Calaby @ 2016-05-30 6:04 ` Kirtika Ruchandani 2016-05-30 6:06 ` Julian Calaby 0 siblings, 1 reply; 24+ messages in thread From: Kirtika Ruchandani @ 2016-05-30 6:04 UTC (permalink / raw) To: Julian Calaby; +Cc: Johannes Berg, linux-wireless, Tina Ruchandani, netdev > Adding the brackets around the & expression doesn't look spacing > related to me. What's the exact warning this is fixing? >From the commit message - "This patch also contains two hunks to fix 'line over 80 characters', that are spacing related". This is the second hunk, the first being the comments in the nl80211_fam definition. Should I resend with these two hunks omitted, or fix my wording? ^ permalink raw reply [flat|nested] 24+ messages in thread
* Re: [PATCH v2 06/10] nl80211: Various checkpatch.pl spacing fixes 2016-05-30 6:04 ` Kirtika Ruchandani @ 2016-05-30 6:06 ` Julian Calaby 0 siblings, 0 replies; 24+ messages in thread From: Julian Calaby @ 2016-05-30 6:06 UTC (permalink / raw) To: Kirtika Ruchandani; +Cc: Johannes Berg, linux-wireless, Tina Ruchandani, netdev Hi Kirtika, On Mon, May 30, 2016 at 4:04 PM, Kirtika Ruchandani <kirtika.ruchandani@gmail.com> wrote: >> Adding the brackets around the & expression doesn't look spacing >> related to me. What's the exact warning this is fixing? > > From the commit message - "This patch also contains two hunks to fix > 'line over 80 characters', > that are spacing related". This is the second hunk, the first being > the comments in the nl80211_fam > definition. Should I resend with these two hunks omitted, or fix my wording? That explains it, I missed that bit. Thanks, -- Julian Calaby Email: julian.calaby@gmail.com Profile: http://www.google.com/profiles/julian.calaby/ ^ permalink raw reply [flat|nested] 24+ messages in thread
* Re: [PATCH v2 06/10] nl80211: Various checkpatch.pl spacing fixes 2016-05-30 2:53 ` [PATCH v2 06/10] nl80211: Various checkpatch.pl spacing fixes Kirtika Ruchandani 2016-05-30 5:25 ` Julian Calaby @ 2016-05-30 6:07 ` Julian Calaby 1 sibling, 0 replies; 24+ messages in thread From: Julian Calaby @ 2016-05-30 6:07 UTC (permalink / raw) To: Kirtika Ruchandani; +Cc: Johannes Berg, linux-wireless, Tina Ruchandani, netdev Hi All, On Mon, May 30, 2016 at 12:53 PM, Kirtika Ruchandani <kirtika.ruchandani@gmail.com> wrote: > This patch fixes the following spacing issues reported > by checkpatch.pl - > - space preferred around that <operator> > - no space needed after cast. > - Alignment should match open parenthesis > - suspect code indent for conditional statements > - Statements should start on a tabstop > > This patch also contains two hunks to fix 'line over 80 characters', > that are spacing related. > All other instances of that warning have been ignored. > > Signed-off-by: Kirtika Ruchandani <kirtika.ruchandani@gmail.com> With Kirtika's explanation, this is: Reviewed-by: Julian Calaby <julian.calaby@gmail.com> Thanks, Julian Calaby > --- > net/wireless/nl80211.c | 103 ++++++++++++++++++++++++++----------------------- > 1 file changed, 54 insertions(+), 49 deletions(-) > > diff --git a/net/wireless/nl80211.c b/net/wireless/nl80211.c > index 11cbf0b..ad7cdce 100644 > --- a/net/wireless/nl80211.c > +++ b/net/wireless/nl80211.c > @@ -39,10 +39,10 @@ static void nl80211_post_doit(const struct genl_ops *ops, struct sk_buff *skb, > > /* the netlink family */ > static struct genl_family nl80211_fam = { > - .id = GENL_ID_GENERATE, /* don't bother with a hardcoded ID */ > - .name = NL80211_GENL_NAME, /* have users key off the name instead */ > - .hdrsize = 0, /* no private header */ > - .version = 1, /* no particular meaning now */ > + .id = GENL_ID_GENERATE, /* don't bother with a hardcoded ID */ > + .name = NL80211_GENL_NAME, /* have users key off the name instead */ > + .hdrsize = 0, /* no private header */ > + .version = 1, /* no particular meaning now */ > .maxattr = NL80211_ATTR_MAX, > .netnsok = true, > .pre_doit = nl80211_pre_doit, > @@ -213,7 +213,7 @@ cfg80211_get_dev_from_info(struct net *netns, struct genl_info *info) > static const struct nla_policy nl80211_policy[NUM_NL80211_ATTR] = { > [NL80211_ATTR_WIPHY] = { .type = NLA_U32 }, > [NL80211_ATTR_WIPHY_NAME] = { .type = NLA_NUL_STRING, > - .len = 20-1 }, > + .len = 20 - 1 }, > [NL80211_ATTR_WIPHY_TXQ_PARAMS] = { .type = NLA_NESTED }, > > [NL80211_ATTR_WIPHY_FREQ] = { .type = NLA_U32 }, > @@ -231,7 +231,7 @@ static const struct nla_policy nl80211_policy[NUM_NL80211_ATTR] = { > > [NL80211_ATTR_IFTYPE] = { .type = NLA_U32 }, > [NL80211_ATTR_IFINDEX] = { .type = NLA_U32 }, > - [NL80211_ATTR_IFNAME] = { .type = NLA_NUL_STRING, .len = IFNAMSIZ-1 }, > + [NL80211_ATTR_IFNAME] = { .type = NLA_NUL_STRING, .len = IFNAMSIZ - 1 }, > > [NL80211_ATTR_MAC] = { .len = ETH_ALEN }, > [NL80211_ATTR_PREV_BSSID] = { .len = ETH_ALEN }, > @@ -967,7 +967,7 @@ static int nl80211_put_iface_combinations(struct wiphy *wiphy, > int i, j; > > nl_combis = nla_nest_start(msg, > - NL80211_ATTR_INTERFACE_COMBINATIONS); > + NL80211_ATTR_INTERFACE_COMBINATIONS); > if (!nl_combis) > goto nla_put_failure; > > @@ -1012,9 +1012,9 @@ static int nl80211_put_iface_combinations(struct wiphy *wiphy, > goto nla_put_failure; > if (large && > (nla_put_u32(msg, NL80211_IFACE_COMB_RADAR_DETECT_WIDTHS, > - c->radar_detect_widths) || > + c->radar_detect_widths) || > nla_put_u32(msg, NL80211_IFACE_COMB_RADAR_DETECT_REGIONS, > - c->radar_detect_regions))) > + c->radar_detect_regions))) > goto nla_put_failure; > > nla_nest_end(msg, nl_combi); > @@ -1493,7 +1493,7 @@ static int nl80211_send_wiphy(struct cfg80211_registered_device *rdev, > > i = 0; > #define CMD(op, n) \ > - do { \ > + do { \ > if (rdev->ops->op) { \ > i++; \ > if (nla_put_u32(msg, i, NL80211_CMD_ ## n)) \ > @@ -1735,8 +1735,9 @@ static int nl80211_send_wiphy(struct cfg80211_registered_device *rdev, > rdev->wiphy.max_num_csa_counters)) > goto nla_put_failure; > > - if (rdev->wiphy.regulatory_flags & REGULATORY_WIPHY_SELF_MANAGED && > - nla_put_flag(msg, NL80211_ATTR_WIPHY_SELF_MANAGED_REG)) > + if ((rdev->wiphy.regulatory_flags & > + REGULATORY_WIPHY_SELF_MANAGED) && > + nla_put_flag(msg, NL80211_ATTR_WIPHY_SELF_MANAGED_REG)) > goto nla_put_failure; > > if (nla_put(msg, NL80211_ATTR_EXT_FEATURES, > @@ -2299,7 +2300,7 @@ static int nl80211_set_wiphy(struct sk_buff *skb, struct genl_info *info) > if (frag_threshold < 256) > return -EINVAL; > > - if (frag_threshold != (u32) -1) { > + if (frag_threshold != (u32)-1) { > /* Fragments (apart from the last one) are required to > * have even length. Make the fragmentation code > * simpler by stripping LSB should someone try to use > @@ -2406,7 +2407,8 @@ static int nl80211_send_chandef(struct sk_buff *msg, > return 0; > } > > -static int nl80211_send_iface(struct sk_buff *msg, u32 portid, u32 seq, int flags, > +static int nl80211_send_iface(struct sk_buff *msg, > + u32 portid, u32 seq, int flags, > struct cfg80211_registered_device *rdev, > struct wireless_dev *wdev, bool removal) > { > @@ -2470,7 +2472,8 @@ static int nl80211_send_iface(struct sk_buff *msg, u32 portid, u32 seq, int flag > return -EMSGSIZE; > } > > -static int nl80211_dump_interface(struct sk_buff *skb, struct netlink_callback *cb) > +static int nl80211_dump_interface(struct sk_buff *skb, > + struct netlink_callback *cb) > { > int wp_idx = 0; > int if_idx = 0; > @@ -2557,7 +2560,7 @@ static int parse_monitor_flags(struct nlattr *nla, u32 *mntrflags) > > for (flag = 1; flag <= NL80211_MNTR_FLAG_MAX; flag++) > if (flags[flag]) > - *mntrflags |= (1<<flag); > + *mntrflags |= (1 << flag); > > return 0; > } > @@ -2722,9 +2725,9 @@ static int nl80211_new_interface(struct sk_buff *skb, struct genl_info *info) > return -ENOMEM; > > wdev = rdev_add_virtual_intf(rdev, > - nla_data(info->attrs[NL80211_ATTR_IFNAME]), > - NET_NAME_USER, type, err ? NULL : &flags, > - ¶ms); > + nla_data(info->attrs[NL80211_ATTR_IFNAME]), > + NET_NAME_USER, type, err ? NULL : &flags, > + ¶ms); > if (WARN_ON(!wdev)) { > nlmsg_free(msg); > return -EPROTO; > @@ -3000,7 +3003,7 @@ static int nl80211_set_key(struct sk_buff *skb, struct genl_info *info) > goto out; > > err = rdev_set_default_key(rdev, dev, key.idx, > - key.def_uni, key.def_multi); > + key.def_uni, key.def_multi); > > if (err) > goto out; > @@ -3621,7 +3624,7 @@ static int parse_station_flags(struct genl_info *info, > > for (flag = 1; flag <= NL80211_STA_FLAG_MAX; flag++) { > if (flags[flag]) { > - params->sta_flags_set |= (1<<flag); > + params->sta_flags_set |= (1 << flag); > > /* no longer support new API additions in old API */ > if (flag > NL80211_STA_FLAG_MAX_OLD_API) > @@ -3949,10 +3952,10 @@ static int nl80211_dump_station(struct sk_buff *skb, > goto out_err; > > if (nl80211_send_station(skb, NL80211_CMD_NEW_STATION, > - NETLINK_CB(cb->skb).portid, > - cb->nlh->nlmsg_seq, NLM_F_MULTI, > - rdev, wdev->netdev, mac_addr, > - &sinfo) < 0) > + NETLINK_CB(cb->skb).portid, > + cb->nlh->nlmsg_seq, NLM_F_MULTI, > + rdev, wdev->netdev, mac_addr, > + &sinfo) < 0) > goto out; > > sta_idx++; > @@ -4224,7 +4227,7 @@ static int nl80211_parse_sta_wme(struct genl_info *info, > } > > static int nl80211_parse_sta_channel_info(struct genl_info *info, > - struct station_parameters *params) > + struct station_parameters *params) > { > if (info->attrs[NL80211_ATTR_STA_SUPPORTED_CHANNELS]) { > params->supported_channels = > @@ -4655,9 +4658,9 @@ static int nl80211_del_station(struct sk_buff *skb, struct genl_info *info) > } > > static int nl80211_send_mpath(struct sk_buff *msg, u32 portid, u32 seq, > - int flags, struct net_device *dev, > - u8 *dst, u8 *next_hop, > - struct mpath_info *pinfo) > + int flags, struct net_device *dev, > + u8 *dst, u8 *next_hop, > + struct mpath_info *pinfo) > { > void *hdr; > struct nlattr *pinfoattr; > @@ -4790,7 +4793,7 @@ static int nl80211_get_mpath(struct sk_buff *skb, struct genl_info *info) > return -ENOMEM; > > if (nl80211_send_mpath(msg, info->snd_portid, info->snd_seq, 0, > - dev, dst, next_hop, &pinfo) < 0) { > + dev, dst, next_hop, &pinfo) < 0) { > nlmsg_free(msg); > return -ENOBUFS; > } > @@ -5185,7 +5188,8 @@ static int nl80211_get_mesh_config(struct sk_buff *skb, > return -ENOBUFS; > } > > -static const struct nla_policy nl80211_meshconf_params_policy[NL80211_MESHCONF_ATTR_MAX+1] = { > +static const > +struct nla_policy nl80211_meshconf_params_policy[NL80211_MESHCONF_ATTR_MAX + 1] = { > [NL80211_MESHCONF_RETRY_TIMEOUT] = { .type = NLA_U16 }, > [NL80211_MESHCONF_CONFIRM_TIMEOUT] = { .type = NLA_U16 }, > [NL80211_MESHCONF_HOLDING_TIMEOUT] = { .type = NLA_U16 }, > @@ -5217,7 +5221,7 @@ static const struct nla_policy nl80211_meshconf_params_policy[NL80211_MESHCONF_A > }; > > static const struct nla_policy > - nl80211_mesh_setup_params_policy[NL80211_MESH_SETUP_ATTR_MAX+1] = { > + nl80211_mesh_setup_params_policy[NL80211_MESH_SETUP_ATTR_MAX + 1] = { > [NL80211_MESH_SETUP_ENABLE_VENDOR_SYNC] = { .type = NLA_U8 }, > [NL80211_MESH_SETUP_ENABLE_VENDOR_PATH_SEL] = { .type = NLA_U8 }, > [NL80211_MESH_SETUP_ENABLE_VENDOR_METRIC] = { .type = NLA_U8 }, > @@ -5363,7 +5367,7 @@ do { \ > } > > static int nl80211_parse_mesh_setup(struct genl_info *info, > - struct mesh_setup *setup) > + struct mesh_setup *setup) > { > struct cfg80211_registered_device *rdev = info->user_ptr[0]; > struct nlattr *tb[NL80211_MESH_SETUP_ATTR_MAX + 1]; > @@ -5672,7 +5676,7 @@ static const struct nla_policy reg_rule_policy[NL80211_REG_RULE_ATTR_MAX + 1] = > }; > > static int parse_reg_rule(struct nlattr *tb[], > - struct ieee80211_reg_rule *reg_rule) > + struct ieee80211_reg_rule *reg_rule) > { > struct ieee80211_freq_range *freq_range = ®_rule->freq_range; > struct ieee80211_power_rule *power_rule = ®_rule->power_rule; > @@ -6686,7 +6690,7 @@ static int nl80211_channel_switch(struct sk_buff *skb, struct genl_info *info) > /* csa_attrs is defined static to avoid waste of stack size - this > * function is called under RTNL lock, so this should not be a problem. > */ > - static struct nlattr *csa_attrs[NL80211_ATTR_MAX+1]; > + static struct nlattr *csa_attrs[NL80211_ATTR_MAX + 1]; > int err; > bool need_new_beacon = false; > int len, i; > @@ -6982,8 +6986,8 @@ static int nl80211_dump_scan(struct sk_buff *skb, struct netlink_callback *cb) > if (++idx <= start) > continue; > if (nl80211_send_bss(skb, cb, > - cb->nlh->nlmsg_seq, NLM_F_MULTI, > - rdev, wdev, scan) < 0) { > + cb->nlh->nlmsg_seq, NLM_F_MULTI, > + rdev, wdev, scan) < 0) { > idx--; > break; > } > @@ -7035,7 +7039,7 @@ static int nl80211_send_survey(struct sk_buff *msg, u32 portid, u32 seq, > goto nla_put_failure; > if ((survey->filled & SURVEY_INFO_TIME) && > nla_put_u64_64bit(msg, NL80211_SURVEY_INFO_TIME, > - survey->time, NL80211_SURVEY_INFO_PAD)) > + survey->time, NL80211_SURVEY_INFO_PAD)) > goto nla_put_failure; > if ((survey->filled & SURVEY_INFO_TIME_BUSY) && > nla_put_u64_64bit(msg, NL80211_SURVEY_INFO_TIME_BUSY, > @@ -7109,9 +7113,9 @@ static int nl80211_dump_survey(struct sk_buff *skb, struct netlink_callback *cb) > } > > if (nl80211_send_survey(skb, > - NETLINK_CB(cb->skb).portid, > - cb->nlh->nlmsg_seq, NLM_F_MULTI, > - wdev->netdev, radio_stats, &survey) < 0) > + NETLINK_CB(cb->skb).portid, > + cb->nlh->nlmsg_seq, NLM_F_MULTI, > + wdev->netdev, radio_stats, &survey) < 0) > goto out; > survey_idx++; > } > @@ -7674,8 +7678,8 @@ static int nl80211_join_ibss(struct sk_buff *skb, struct genl_info *info) > bool no_ht = false; > > connkeys = nl80211_parse_connkeys(rdev, > - info->attrs[NL80211_ATTR_KEYS], > - &no_ht); > + info->attrs[NL80211_ATTR_KEYS], > + &no_ht); > if (IS_ERR(connkeys)) > return PTR_ERR(connkeys); > > @@ -8022,7 +8026,7 @@ static int nl80211_connect(struct sk_buff *skb, struct genl_info *info) > > connect.bg_scan_period = -1; > if (info->attrs[NL80211_ATTR_BG_SCAN_PERIOD] && > - (wiphy->flags & WIPHY_FLAG_SUPPORTS_FW_ROAM)) { > + (wiphy->flags & WIPHY_FLAG_SUPPORTS_FW_ROAM)) { > connect.bg_scan_period = > nla_get_u16(info->attrs[NL80211_ATTR_BG_SCAN_PERIOD]); > } > @@ -8067,7 +8071,8 @@ static int nl80211_connect(struct sk_buff *skb, struct genl_info *info) > > if (connect.privacy && info->attrs[NL80211_ATTR_KEYS]) { > connkeys = nl80211_parse_connkeys(rdev, > - info->attrs[NL80211_ATTR_KEYS], NULL); > + info->attrs[NL80211_ATTR_KEYS], > + NULL); > if (IS_ERR(connkeys)) > return PTR_ERR(connkeys); > } > @@ -9046,7 +9051,7 @@ static int nl80211_join_mesh(struct sk_buff *skb, struct genl_info *info) > if (info->attrs[NL80211_ATTR_MCAST_RATE] && > !nl80211_parse_mcast_rate(rdev, setup.mcast_rate, > nla_get_u32(info->attrs[NL80211_ATTR_MCAST_RATE]))) > - return -EINVAL; > + return -EINVAL; > > if (info->attrs[NL80211_ATTR_BEACON_INTERVAL]) { > setup.beacon_interval = > @@ -12234,7 +12239,7 @@ void cfg80211_notify_new_peer_candidate(struct net_device *dev, const u8 *addr, > nla_put_u32(msg, NL80211_ATTR_IFINDEX, dev->ifindex) || > nla_put(msg, NL80211_ATTR_MAC, ETH_ALEN, addr) || > (ie_len && ie && > - nla_put(msg, NL80211_ATTR_IE, ie_len , ie))) > + nla_put(msg, NL80211_ATTR_IE, ie_len, ie))) > goto nla_put_failure; > > genlmsg_end(msg, hdr); > @@ -12958,7 +12963,7 @@ static void nl80211_ch_switch_notify(struct cfg80211_registered_device *rdev, > > if ((notif == NL80211_CMD_CH_SWITCH_STARTED_NOTIFY) && > (nla_put_u32(msg, NL80211_ATTR_CH_SWITCH_COUNT, count))) > - goto nla_put_failure; > + goto nla_put_failure; > > genlmsg_end(msg, hdr); > > @@ -13297,7 +13302,7 @@ void cfg80211_report_wowlan_wakeup(struct wireless_dev *wdev, > > if (wakeup->net_detect && > cfg80211_net_detect_results(msg, wakeup)) > - goto free_msg; > + goto free_msg; > > nla_nest_end(msg, reasons); > } > -- > 2.8.0.rc3.226.g39d4020 > -- Julian Calaby Email: julian.calaby@gmail.com Profile: http://www.google.com/profiles/julian.calaby/ ^ permalink raw reply [flat|nested] 24+ messages in thread
* [PATCH v2 07/10] nl80211: Avoid multiple assignments on same line 2016-05-30 2:49 [PATCH v2 00/10] nl80211: Fix checkpatch.pl issues Kirtika Ruchandani ` (2 preceding siblings ...) 2016-05-30 2:53 ` [PATCH v2 06/10] nl80211: Various checkpatch.pl spacing fixes Kirtika Ruchandani @ 2016-05-30 2:53 ` Kirtika Ruchandani [not found] ` <637c25b980379d1a98d7c57cc247d49ef295cbc5.1464576022.git.kirtika.ruchandani-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> 2016-05-30 2:54 ` [PATCH v2 10/10] nl80211: Prefer kcalloc over kzalloc Kirtika Ruchandani 4 siblings, 1 reply; 24+ messages in thread From: Kirtika Ruchandani @ 2016-05-30 2:53 UTC (permalink / raw) To: Johannes Berg; +Cc: linux-wireless, ruchandani.tina, netdev, Julian.Calaby This patch fixes the checkpatch.pl warning "multiple assignments should be avoided." Signed-off-by: Kirtika Ruchandani <kirtika.ruchandani@gmail.com> --- net/wireless/nl80211.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/net/wireless/nl80211.c b/net/wireless/nl80211.c index ad7cdce..6f8e2a7 100644 --- a/net/wireless/nl80211.c +++ b/net/wireless/nl80211.c @@ -2603,7 +2603,8 @@ static int nl80211_set_interface(struct sk_buff *skb, struct genl_info *info) memset(¶ms, 0, sizeof(params)); - otype = ntype = dev->ieee80211_ptr->iftype; + otype = dev->ieee80211_ptr->iftype; + ntype = dev->ieee80211_ptr->iftype; if (info->attrs[NL80211_ATTR_IFTYPE]) { ntype = nla_get_u32(info->attrs[NL80211_ATTR_IFTYPE]); ^ permalink raw reply related [flat|nested] 24+ messages in thread
[parent not found: <637c25b980379d1a98d7c57cc247d49ef295cbc5.1464576022.git.kirtika.ruchandani-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>]
* Re: [PATCH v2 07/10] nl80211: Avoid multiple assignments on same line [not found] ` <637c25b980379d1a98d7c57cc247d49ef295cbc5.1464576022.git.kirtika.ruchandani-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> @ 2016-05-30 5:30 ` Julian Calaby 0 siblings, 0 replies; 24+ messages in thread From: Julian Calaby @ 2016-05-30 5:30 UTC (permalink / raw) To: Kirtika Ruchandani; +Cc: Johannes Berg, linux-wireless, Tina Ruchandani, netdev Hi All, On Mon, May 30, 2016 at 12:53 PM, Kirtika Ruchandani <kirtika.ruchandani-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote: > This patch fixes the checkpatch.pl warning "multiple assignments > should be avoided." > > Signed-off-by: Kirtika Ruchandani <kirtika.ruchandani-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> I'm not sure I agree with checkpatch here, but this looks right to me. Reviewed-by: Julian Calaby <julian.calaby-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> Thanks, Julian Calaby > --- > net/wireless/nl80211.c | 3 ++- > 1 file changed, 2 insertions(+), 1 deletion(-) > > diff --git a/net/wireless/nl80211.c b/net/wireless/nl80211.c > index ad7cdce..6f8e2a7 100644 > --- a/net/wireless/nl80211.c > +++ b/net/wireless/nl80211.c > @@ -2603,7 +2603,8 @@ static int nl80211_set_interface(struct sk_buff *skb, struct genl_info *info) > > memset(¶ms, 0, sizeof(params)); > > - otype = ntype = dev->ieee80211_ptr->iftype; > + otype = dev->ieee80211_ptr->iftype; > + ntype = dev->ieee80211_ptr->iftype; > > if (info->attrs[NL80211_ATTR_IFTYPE]) { > ntype = nla_get_u32(info->attrs[NL80211_ATTR_IFTYPE]); > -- > 2.8.0.rc3.226.g39d4020 > -- Julian Calaby Email: julian.calaby-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org Profile: http://www.google.com/profiles/julian.calaby/ -- To unsubscribe from this list: send the line "unsubscribe linux-wireless" in the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org More majordomo info at http://vger.kernel.org/majordomo-info.html ^ permalink raw reply [flat|nested] 24+ messages in thread
* [PATCH v2 10/10] nl80211: Prefer kcalloc over kzalloc 2016-05-30 2:49 [PATCH v2 00/10] nl80211: Fix checkpatch.pl issues Kirtika Ruchandani ` (3 preceding siblings ...) 2016-05-30 2:53 ` [PATCH v2 07/10] nl80211: Avoid multiple assignments on same line Kirtika Ruchandani @ 2016-05-30 2:54 ` Kirtika Ruchandani [not found] ` <ca13e9bde679512a872e5136c177676d0238dc25.1464576022.git.kirtika.ruchandani-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> 4 siblings, 1 reply; 24+ messages in thread From: Kirtika Ruchandani @ 2016-05-30 2:54 UTC (permalink / raw) To: Johannes Berg; +Cc: linux-wireless, ruchandani.tina, netdev, Julian.Calaby This patch fixes the checkpatch.pl warning - "prefer kcalloc over kzalloc with multiply" Signed-off-by: Kirtika Ruchandani <kirtika.ruchandani@gmail.com> --- net/wireless/nl80211.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/net/wireless/nl80211.c b/net/wireless/nl80211.c index 46757af..2964406 100644 --- a/net/wireless/nl80211.c +++ b/net/wireless/nl80211.c @@ -9482,7 +9482,7 @@ static int nl80211_parse_wowlan_nd(struct cfg80211_registered_device *rdev, struct nlattr **tb; int err; - tb = kzalloc(NUM_NL80211_ATTR * sizeof(*tb), GFP_KERNEL); + tb = kcalloc(NUM_NL80211_ATTR, sizeof(*tb), GFP_KERNEL); if (!tb) return -ENOMEM; ^ permalink raw reply related [flat|nested] 24+ messages in thread
[parent not found: <ca13e9bde679512a872e5136c177676d0238dc25.1464576022.git.kirtika.ruchandani-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>]
* Re: [PATCH v2 10/10] nl80211: Prefer kcalloc over kzalloc [not found] ` <ca13e9bde679512a872e5136c177676d0238dc25.1464576022.git.kirtika.ruchandani-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> @ 2016-05-30 5:32 ` Julian Calaby 0 siblings, 0 replies; 24+ messages in thread From: Julian Calaby @ 2016-05-30 5:32 UTC (permalink / raw) To: Kirtika Ruchandani; +Cc: Johannes Berg, linux-wireless, Tina Ruchandani, netdev Hi All, On Mon, May 30, 2016 at 12:54 PM, Kirtika Ruchandani <kirtika.ruchandani-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote: > This patch fixes the checkpatch.pl warning - > "prefer kcalloc over kzalloc with multiply" > > Signed-off-by: Kirtika Ruchandani <kirtika.ruchandani-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> Looks right to me. Reviewed-by: Julian Calaby <julian.calaby-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> Thanks, Julian Calaby > --- > net/wireless/nl80211.c | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) > > diff --git a/net/wireless/nl80211.c b/net/wireless/nl80211.c > index 46757af..2964406 100644 > --- a/net/wireless/nl80211.c > +++ b/net/wireless/nl80211.c > @@ -9482,7 +9482,7 @@ static int nl80211_parse_wowlan_nd(struct cfg80211_registered_device *rdev, > struct nlattr **tb; > int err; > > - tb = kzalloc(NUM_NL80211_ATTR * sizeof(*tb), GFP_KERNEL); > + tb = kcalloc(NUM_NL80211_ATTR, sizeof(*tb), GFP_KERNEL); > if (!tb) > return -ENOMEM; > > -- > 2.8.0.rc3.226.g39d4020 > -- Julian Calaby Email: julian.calaby-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org Profile: http://www.google.com/profiles/julian.calaby/ -- To unsubscribe from this list: send the line "unsubscribe linux-wireless" in the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org More majordomo info at http://vger.kernel.org/majordomo-info.html ^ permalink raw reply [flat|nested] 24+ messages in thread
end of thread, other threads:[~2016-05-31 10:34 UTC | newest] Thread overview: 24+ messages (download: mbox.gz follow: Atom feed -- links below jump to the message on this page -- 2016-05-30 2:49 [PATCH v2 00/10] nl80211: Fix checkpatch.pl issues Kirtika Ruchandani [not found] ` <cover.1464576022.git.kirtika.ruchandani-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> 2016-05-30 2:50 ` [PATCH v2 01/10] nl80211: Fix checkpatch warnings Kirtika Ruchandani 2016-05-30 2:51 ` [PATCH v2 02/10] nl80211: Fix checkpatch warnings about blank lines Kirtika Ruchandani 2016-05-30 2:52 ` [PATCH v2 03/10] nl80211: Prefer ether_addr_copy Kirtika Ruchandani [not found] ` <49c03996365360077fe7317d108072c30354b555.1464576022.git.kirtika.ruchandani-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> 2016-05-30 5:21 ` Julian Calaby 2016-05-30 6:50 ` Kirtika Ruchandani 2016-05-31 10:34 ` Johannes Berg 2016-05-30 2:52 ` [PATCH v2 04/10] nl80211: Fix checkpatch.pl warning about braces Kirtika Ruchandani [not found] ` <aef84fd2cf9f2e8fc81b366c83cb38402513f5b1.1464576022.git.kirtika.ruchandani-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> 2016-05-30 5:22 ` Julian Calaby 2016-05-30 2:54 ` [PATCH v2 08/10] nl80211: Fix spelling Kirtika Ruchandani 2016-05-30 5:31 ` Julian Calaby 2016-05-30 2:54 ` [PATCH v2 09/10] nl80211: Fix checkpatch.pl warning Kirtika Ruchandani [not found] ` <2b42b54b8128bb953569021ddadce77499859a79.1464576022.git.kirtika.ruchandani-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> 2016-05-30 5:31 ` Julian Calaby 2016-05-30 2:52 ` [PATCH v2 05/10] nl80211: Fix checkpatch.pl NULL comparison warning Kirtika Ruchandani 2016-05-30 5:22 ` Julian Calaby 2016-05-30 2:53 ` [PATCH v2 06/10] nl80211: Various checkpatch.pl spacing fixes Kirtika Ruchandani 2016-05-30 5:25 ` Julian Calaby 2016-05-30 6:04 ` Kirtika Ruchandani 2016-05-30 6:06 ` Julian Calaby 2016-05-30 6:07 ` Julian Calaby 2016-05-30 2:53 ` [PATCH v2 07/10] nl80211: Avoid multiple assignments on same line Kirtika Ruchandani [not found] ` <637c25b980379d1a98d7c57cc247d49ef295cbc5.1464576022.git.kirtika.ruchandani-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> 2016-05-30 5:30 ` Julian Calaby 2016-05-30 2:54 ` [PATCH v2 10/10] nl80211: Prefer kcalloc over kzalloc Kirtika Ruchandani [not found] ` <ca13e9bde679512a872e5136c177676d0238dc25.1464576022.git.kirtika.ruchandani-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> 2016-05-30 5:32 ` Julian Calaby
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox; as well as URLs for NNTP newsgroup(s).