Skip to content

Commit

Permalink
nl80211: remove bogus genlmsg_end() error checking
Browse files Browse the repository at this point in the history
genlmsg_end() can't return an error since it returns the
skb length so remove checks treating the return value as
an error code.

Signed-off-by: Johannes Berg <johannes.berg@intel.com>
  • Loading branch information
Johannes Berg committed Jun 4, 2013
1 parent d6d23de commit 9c90a9f
Showing 1 changed file with 7 additions and 33 deletions.
40 changes: 7 additions & 33 deletions net/wireless/nl80211.c
Original file line number Diff line number Diff line change
Expand Up @@ -9848,7 +9848,6 @@ static bool __nl80211_unexpected_frame(struct net_device *dev, u8 cmd,
struct cfg80211_registered_device *rdev = wiphy_to_dev(wdev->wiphy);
struct sk_buff *msg;
void *hdr;
int err;
u32 nlportid = ACCESS_ONCE(wdev->ap_unexpected_nlportid);

if (!nlportid)
Expand All @@ -9869,12 +9868,7 @@ static bool __nl80211_unexpected_frame(struct net_device *dev, u8 cmd,
nla_put(msg, NL80211_ATTR_MAC, ETH_ALEN, addr))
goto nla_put_failure;

err = genlmsg_end(msg, hdr);
if (err < 0) {
nlmsg_free(msg);
return true;
}

genlmsg_end(msg, hdr);
genlmsg_unicast(wiphy_net(&rdev->wiphy), msg, nlportid);
return true;

Expand Down Expand Up @@ -10317,10 +10311,7 @@ nl80211_radar_notify(struct cfg80211_registered_device *rdev,
if (nl80211_send_chandef(msg, chandef))
goto nla_put_failure;

if (genlmsg_end(msg, hdr) < 0) {
nlmsg_free(msg);
return;
}
genlmsg_end(msg, hdr);

genlmsg_multicast_netns(wiphy_net(&rdev->wiphy), msg, 0,
nl80211_mlme_mcgrp.id, gfp);
Expand Down Expand Up @@ -10386,7 +10377,6 @@ void cfg80211_probe_status(struct net_device *dev, const u8 *addr,
struct cfg80211_registered_device *rdev = wiphy_to_dev(wdev->wiphy);
struct sk_buff *msg;
void *hdr;
int err;

trace_cfg80211_probe_status(dev, addr, cookie, acked);

Expand All @@ -10408,11 +10398,7 @@ void cfg80211_probe_status(struct net_device *dev, const u8 *addr,
(acked && nla_put_flag(msg, NL80211_ATTR_ACK)))
goto nla_put_failure;

err = genlmsg_end(msg, hdr);
if (err < 0) {
nlmsg_free(msg);
return;
}
genlmsg_end(msg, hdr);

genlmsg_multicast_netns(wiphy_net(&rdev->wiphy), msg, 0,
nl80211_mlme_mcgrp.id, gfp);
Expand Down Expand Up @@ -10478,7 +10464,7 @@ void cfg80211_report_wowlan_wakeup(struct wireless_dev *wdev,
struct cfg80211_registered_device *rdev = wiphy_to_dev(wdev->wiphy);
struct sk_buff *msg;
void *hdr;
int err, size = 200;
int size = 200;

trace_cfg80211_report_wowlan_wakeup(wdev->wiphy, wdev, wakeup);

Expand Down Expand Up @@ -10564,9 +10550,7 @@ void cfg80211_report_wowlan_wakeup(struct wireless_dev *wdev,
nla_nest_end(msg, reasons);
}

err = genlmsg_end(msg, hdr);
if (err < 0)
goto free_msg;
genlmsg_end(msg, hdr);

genlmsg_multicast_netns(wiphy_net(&rdev->wiphy), msg, 0,
nl80211_mlme_mcgrp.id, gfp);
Expand All @@ -10586,7 +10570,6 @@ void cfg80211_tdls_oper_request(struct net_device *dev, const u8 *peer,
struct cfg80211_registered_device *rdev = wiphy_to_dev(wdev->wiphy);
struct sk_buff *msg;
void *hdr;
int err;

trace_cfg80211_tdls_oper_request(wdev->wiphy, dev, peer, oper,
reason_code);
Expand All @@ -10609,11 +10592,7 @@ void cfg80211_tdls_oper_request(struct net_device *dev, const u8 *peer,
nla_put_u16(msg, NL80211_ATTR_REASON_CODE, reason_code)))
goto nla_put_failure;

err = genlmsg_end(msg, hdr);
if (err < 0) {
nlmsg_free(msg);
return;
}
genlmsg_end(msg, hdr);

genlmsg_multicast_netns(wiphy_net(&rdev->wiphy), msg, 0,
nl80211_mlme_mcgrp.id, gfp);
Expand Down Expand Up @@ -10671,7 +10650,6 @@ void cfg80211_ft_event(struct net_device *netdev,
struct cfg80211_registered_device *rdev = wiphy_to_dev(wiphy);
struct sk_buff *msg;
void *hdr;
int err;

trace_cfg80211_ft_event(wiphy, netdev, ft_event);

Expand All @@ -10697,11 +10675,7 @@ void cfg80211_ft_event(struct net_device *netdev,
nla_put(msg, NL80211_ATTR_IE_RIC, ft_event->ric_ies_len,
ft_event->ric_ies);

err = genlmsg_end(msg, hdr);
if (err < 0) {
nlmsg_free(msg);
return;
}
genlmsg_end(msg, hdr);

genlmsg_multicast_netns(wiphy_net(&rdev->wiphy), msg, 0,
nl80211_mlme_mcgrp.id, GFP_KERNEL);
Expand Down

0 comments on commit 9c90a9f

Please sign in to comment.