linux_dsm_epyc7002/drivers/net/wireless
Johannes Berg 053c095a82 netlink: make nlmsg_end() and genlmsg_end() void
Contrary to common expectations for an "int" return, these functions
return only a positive value -- if used correctly they cannot even
return 0 because the message header will necessarily be in the skb.

This makes the very common pattern of

  if (genlmsg_end(...) < 0) { ... }

be a whole bunch of dead code. Many places also simply do

  return nlmsg_end(...);

and the caller is expected to deal with it.

This also commonly (at least for me) causes errors, because it is very
common to write

  if (my_function(...))
    /* error condition */

and if my_function() does "return nlmsg_end()" this is of course wrong.

Additionally, there's not a single place in the kernel that actually
needs the message length returned, and if anyone needs it later then
it'll be very easy to just use skb->len there.

Remove this, and make the functions void. This removes a bunch of dead
code as described above. The patch adds lines because I did

-	return nlmsg_end(...);
+	nlmsg_end(...);
+	return 0;

I could have preserved all the function's return values by returning
skb->len, but instead I've audited all the places calling the affected
functions and found that none cared. A few places actually compared
the return value with <= 0 in dump functionality, but that could just
be changed to < 0 with no change in behaviour, so I opted for the more
efficient version.

One instance of the error I've made numerous times now is also present
in net/phonet/pn_netlink.c in the route_dumpit() function - it didn't
check for <0 or <=0 and thus broke out of the loop every single time.
I've preserved this since it will (I think) have caused the messages to
userspace to be formatted differently with just a single message for
every SKB returned to userspace. It's possible that this isn't needed
for the tools that actually use this, but I don't even know what they
are so couldn't test that changing this behaviour would be acceptable.

Signed-off-by: Johannes Berg <johannes.berg@intel.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
2015-01-18 01:03:45 -05:00
..
ath Here's a big pile of changes for this round. 2015-01-15 19:16:56 -05:00
b43 It has been a while since my last pull request, so we accumulated 2014-11-20 16:09:30 -05:00
b43legacy
brcm80211 Here's a big pile of changes for this round. 2015-01-15 19:16:56 -05:00
cw1200 mac80211: Re-fix accounting of the tailroom-needed counter 2015-01-07 14:39:32 +01:00
hostap hostap_cs: fix misspelling of current function in string 2014-12-15 13:46:19 -05:00
ipw2x00 ipw2200: select CFG80211_WEXT 2014-12-24 15:15:25 +02:00
iwlegacy mac80211: allow channel switch with multiple channel contexts 2014-10-09 11:30:09 +02:00
iwlwifi Here's a big pile of changes for this round. 2015-01-15 19:16:56 -05:00
libertas cfg80211: remove enum station_info_flags 2015-01-08 15:28:10 +01:00
libertas_tf treewide: Fix typo in printk 2014-08-26 09:35:54 +02:00
mwifiex cfg80211: remove enum station_info_flags 2015-01-08 15:28:10 +01:00
orinoco drivers/net: Convert remaining uses of pr_warning to pr_warn 2014-09-09 20:37:08 -07:00
p54 cfg80211: remove "channel" from survey names 2015-01-08 15:27:52 +01:00
prism54 PCI: Remove DEFINE_PCI_DEVICE_TABLE macro use 2014-08-12 12:15:14 -06:00
rsi rsi: fix memory leak in rsi_load_ta_instructions() 2014-12-24 17:26:08 +02:00
rt2x00 Here's a big pile of changes for this round. 2015-01-15 19:16:56 -05:00
rtl818x rtl818x_pci: fix response rate may be incorrect. 2014-10-07 14:48:37 -04:00
rtlwifi Merge git://git.kernel.org/pub/scm/linux/kernel/git/davem/net 2015-01-15 00:53:17 -05:00
ti Here's a big pile of changes for this round. 2015-01-15 19:16:56 -05:00
zd1211rw zd1211rw: fix misspelling of current function in string 2014-12-15 13:46:19 -05:00
adm8211.c PCI: Remove DEFINE_PCI_DEVICE_TABLE macro use 2014-08-12 12:15:14 -06:00
adm8211.h
airo_cs.c airo_cs: Remove typedef local_info_t 2014-08-11 12:19:53 -07:00
airo.c PCI: Remove DEFINE_PCI_DEVICE_TABLE macro use 2014-08-12 12:15:14 -06:00
airo.h
at76c50x-usb.c at76c50x-usb: fix use after free on failure path in at76_probe() 2014-08-25 15:39:23 -04:00
at76c50x-usb.h
atmel_cs.c atmel_cs: Remove typedef local_info_t 2014-08-25 16:17:41 -04:00
atmel_pci.c PCI: Remove DEFINE_PCI_DEVICE_TABLE macro use 2014-08-12 12:15:14 -06:00
atmel.c atmel: Remove typedef atmel_priv_ioctl 2014-08-11 12:19:53 -07:00
atmel.h
Kconfig net: fix USB network driver config option. 2014-08-06 16:00:20 -07:00
mac80211_hwsim.c netlink: make nlmsg_end() and genlmsg_end() void 2015-01-18 01:03:45 -05:00
mac80211_hwsim.h mac80211-hwsim: Add HWSIM_CMD_GET_RADIO command 2014-11-19 18:59:32 +01:00
Makefile
mwl8k.c cfg80211: remove "channel" from survey names 2015-01-08 15:27:52 +01:00
ray_cs.c
ray_cs.h ray_cs: Add include guards 2014-08-28 14:41:56 -04:00
rayctl.h ray_cs: Add include guards 2014-08-28 14:41:56 -04:00
rndis_wlan.c cfg80211: remove enum station_info_flags 2015-01-08 15:28:10 +01:00
wl3501_cs.c
wl3501.h
zd1201.c
zd1201.h