OpenCloudOS-Kernel/drivers/net/wireless/ti/wlcore
Arnd Bergmann 287980e49f remove lots of IS_ERR_VALUE abuses
Most users of IS_ERR_VALUE() in the kernel are wrong, as they
pass an 'int' into a function that takes an 'unsigned long'
argument. This happens to work because the type is sign-extended
on 64-bit architectures before it gets converted into an
unsigned type.

However, anything that passes an 'unsigned short' or 'unsigned int'
argument into IS_ERR_VALUE() is guaranteed to be broken, as are
8-bit integers and types that are wider than 'unsigned long'.

Andrzej Hajda has already fixed a lot of the worst abusers that
were causing actual bugs, but it would be nice to prevent any
users that are not passing 'unsigned long' arguments.

This patch changes all users of IS_ERR_VALUE() that I could find
on 32-bit ARM randconfig builds and x86 allmodconfig. For the
moment, this doesn't change the definition of IS_ERR_VALUE()
because there are probably still architecture specific users
elsewhere.

Almost all the warnings I got are for files that are better off
using 'if (err)' or 'if (err < 0)'.
The only legitimate user I could find that we get a warning for
is the (32-bit only) freescale fman driver, so I did not remove
the IS_ERR_VALUE() there but changed the type to 'unsigned long'.
For 9pfs, I just worked around one user whose calling conventions
are so obscure that I did not dare change the behavior.

I was using this definition for testing:

 #define IS_ERR_VALUE(x) ((unsigned long*)NULL == (typeof (x)*)NULL && \
       unlikely((unsigned long long)(x) >= (unsigned long long)(typeof(x))-MAX_ERRNO))

which ends up making all 16-bit or wider types work correctly with
the most plausible interpretation of what IS_ERR_VALUE() was supposed
to return according to its users, but also causes a compile-time
warning for any users that do not pass an 'unsigned long' argument.

I suggested this approach earlier this year, but back then we ended
up deciding to just fix the users that are obviously broken. After
the initial warning that caused me to get involved in the discussion
(fs/gfs2/dir.c) showed up again in the mainline kernel, Linus
asked me to send the whole thing again.

[ Updated the 9p parts as per Al Viro  - Linus ]

Signed-off-by: Arnd Bergmann <arnd@arndb.de>
Cc: Andrzej Hajda <a.hajda@samsung.com>
Cc: Andrew Morton <akpm@linux-foundation.org>
Link: https://lkml.org/lkml/2016/1/7/363
Link: https://lkml.org/lkml/2016/5/27/486
Acked-by: Srinivas Kandagatla <srinivas.kandagatla@linaro.org> # For nvmem part
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2016-05-27 15:26:11 -07:00
..
Kconfig wlcore/wl12xx: spi: add device tree support 2016-01-29 11:10:10 +02:00
Makefile wlcore: handle smart config vendor commands 2014-07-15 15:59:56 -04:00
acx.c wlcore: split wl12xx/wl18xx sg parameters 2015-12-11 13:10:59 +02:00
acx.h wlcore: split wl12xx/wl18xx sg parameters 2015-12-11 13:10:59 +02:00
boot.c wlcore: remove wl12xx_platform_data 2015-03-24 09:48:14 -07:00
boot.h wlcore: create private static_data area and add operation to parse it 2012-06-05 15:58:20 +03:00
cmd.c cfg80211: remove enum ieee80211_band 2016-04-12 15:56:15 +02:00
cmd.h cfg80211: remove enum ieee80211_band 2016-04-12 15:56:15 +02:00
conf.h wlcore: split wl12xx/wl18xx sg parameters 2015-12-11 13:10:59 +02:00
debug.h drivers/net: Convert remaining uses of pr_warning to pr_warn 2014-09-09 20:37:08 -07:00
debugfs.c Merge git://git.kernel.org/pub/scm/linux/kernel/git/davem/net-next 2016-01-12 18:57:02 -08:00
debugfs.h wl18xx: show rx_frames_per_rates as an array as it really is 2015-03-16 18:07:03 +02:00
event.c wlcore: fix error handling in wlcore_event_fw_logger 2016-01-29 11:14:57 +02:00
event.h wlcore/wl18xx: fw logger over sdio 2015-12-31 10:19:47 +02:00
hw_ops.h wlcore: add dfs master restart calls 2015-01-09 15:48:01 +02:00
ini.h wlcore/wl12xx: add support for HP and SKW FEM radio manufacturers 2012-06-13 21:52:56 +03:00
init.c wlcore/wl18xx: add radar_debug_mode handling 2016-03-10 15:00:23 +02:00
init.h wlcore: add p2p device support 2015-08-10 22:16:34 +03:00
io.c wlcore/wl12xx: Fix fw logger over sdio 2016-05-11 21:26:15 +03:00
io.h wlcore/wl12xx: Fix fw logger over sdio 2016-05-11 21:26:15 +03:00
main.c cfg80211: remove enum ieee80211_band 2016-04-12 15:56:15 +02:00
ps.c cfg80211: remove enum ieee80211_band 2016-04-12 15:56:15 +02:00
ps.h
rx.c cfg80211: remove enum ieee80211_band 2016-04-12 15:56:15 +02:00
rx.h cfg80211: remove enum ieee80211_band 2016-04-12 15:56:15 +02:00
scan.c cfg80211: remove enum ieee80211_band 2016-04-12 15:56:15 +02:00
scan.h wl18xx: use long intervals in sched scan 2015-08-10 22:16:21 +03:00
sdio.c wlcore: sdio: return correct error code 2015-07-21 16:54:15 +03:00
spi.c remove lots of IS_ERR_VALUE abuses 2016-05-27 15:26:11 -07:00
sysfs.c wlcore/wl18xx: fw logger over sdio 2015-12-31 10:19:47 +02:00
sysfs.h wlcore: move sysfs handling to a separate file 2013-06-17 11:56:59 +03:00
testmode.c wlcore: fix interrogate command length 2013-10-23 09:47:40 +03:00
testmode.h mac80211: add vif to testmode cmd 2013-08-12 14:11:42 +02:00
tx.c cfg80211: remove enum ieee80211_band 2016-04-12 15:56:15 +02:00
tx.h cfg80211: remove enum ieee80211_band 2016-04-12 15:56:15 +02:00
vendor_cmd.c wlcore: fix WLCORE_VENDOR_ATTR_GROUP_KEY policy 2015-01-09 15:47:49 +02:00
vendor_cmd.h wlcore/wl18xx: handle smart config events 2014-07-15 15:59:57 -04:00
wl12xx_80211.h
wlcore.h cfg80211: remove enum ieee80211_band 2016-04-12 15:56:15 +02:00
wlcore_i.h cfg80211: remove enum ieee80211_band 2016-04-12 15:56:15 +02:00