WSL2-Linux-Kernel/drivers/ata
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 Merge branch 'for-4.7-dw' of git://git.kernel.org/pub/scm/linux/kernel/git/tj/libata 2016-05-23 18:19:21 -07:00
Makefile ata: add AMD Seattle platform driver 2016-04-13 15:14:24 -04:00
acard-ahci.c
ahci.c AHCI: Remove obsolete Intel Lewisburg SATA RAID device IDs 2016-03-11 12:31:49 -05:00
ahci.h ahci: Cache host controller version 2016-02-19 10:52:46 -05:00
ahci_brcmstb.c drivers: ata: wake port before DMA stop for ALPM 2016-01-25 15:20:44 -05:00
ahci_ceva.c
ahci_da850.c
ahci_imx.c
ahci_mvebu.c ata: ahci_mvebu: add support for Armada 3700 variant 2016-02-18 12:41:17 -05:00
ahci_octeon.c libata: support AHCI on OCTEON platform 2016-02-11 10:12:04 -05:00
ahci_platform.c ata: ahci-platform: Add ports-implemented DT bindings. 2016-04-01 10:30:30 -04:00
ahci_qoriq.c ahci: qoriq: Adjust the default register values on ls1021a 2015-12-16 10:24:35 -05:00
ahci_seattle.c ata: add AMD Seattle platform driver 2016-04-13 15:14:24 -04:00
ahci_st.c
ahci_sunxi.c
ahci_tegra.c
ahci_xgene.c ata: ahci_xgene: dereferencing uninitialized pointer in probe 2016-03-11 12:40:34 -05:00
ata_generic.c
ata_piix.c
libahci.c Merge branch 'for-4.6-fixes' into for-4.7 2016-05-13 17:20:48 -04:00
libahci_platform.c
libata-acpi.c
libata-core.c Merge branch 'for-4.7-zac' of git://git.kernel.org/pub/scm/linux/kernel/git/tj/libata 2016-05-23 17:53:39 -07:00
libata-eh.c libata: Implement ZBC OUT translation 2016-05-09 12:36:46 -04:00
libata-pmp.c ata: pmp: add quirk for Marvell 4140 SATA PMP 2015-07-14 17:46:38 -04:00
libata-scsi.c Merge branch 'for-4.7-zac' of git://git.kernel.org/pub/scm/linux/kernel/git/tj/libata 2016-05-23 17:53:39 -07:00
libata-sff.c libata: fix sff host state machine locking while polling 2016-02-01 11:33:21 -05:00
libata-trace.c libata: NCQ encapsulation for ZAC MANAGEMENT OUT 2016-05-09 12:36:46 -04:00
libata-transport.c libata: add ATA_HORKAGE_NOTRIM 2015-07-15 11:22:35 -04:00
libata-transport.h
libata-zpodd.c
libata.h libata: Implement control mode page to select sense format 2016-04-04 12:07:41 -04:00
pata_acpi.c
pata_ali.c
pata_amd.c
pata_arasan_cf.c Merge branch 'for-4.3' of git://git.kernel.org/pub/scm/linux/kernel/git/tj/libata 2015-09-02 08:00:54 -07:00
pata_artop.c
pata_at32.c
pata_at91.c gpio: Include linux/gpio.h instead of asm/gpio.h 2016-02-16 00:20:03 +01:00
pata_atiixp.c
pata_atp867x.c
pata_bf54x.c gpio: Include linux/gpio.h instead of asm/gpio.h 2016-02-16 00:20:03 +01:00
pata_cmd64x.c
pata_cmd640.c
pata_cs5520.c
pata_cs5530.c
pata_cs5535.c
pata_cs5536.c
pata_cypress.c
pata_efar.c
pata_ep93xx.c
pata_hpt3x2n.c
pata_hpt3x3.c
pata_hpt37x.c
pata_hpt366.c ata: hpt366: convert to use match_string() helper 2016-03-17 15:09:34 -07:00
pata_icside.c scsi: rename SCSI_MAX_{SG, SG_CHAIN}_SEGMENTS 2016-04-15 16:53:14 -04:00
pata_imx.c
pata_isapnp.c
pata_it821x.c pata_it821x: use "const char *" for string literals 2015-10-15 10:58:53 -04:00
pata_it8213.c
pata_ixp4xx_cf.c
pata_jmicron.c PCI: Disable async suspend/resume for JMicron multi-function SATA/AHCI 2015-08-24 15:27:11 -05:00
pata_legacy.c
pata_macio.c PCI: Remove includes of asm/pci-bridge.h 2016-02-05 16:29:28 -06:00
pata_marvell.c
pata_mpc52xx.c
pata_mpiix.c
pata_netcell.c
pata_ninja32.c
pata_ns87410.c
pata_ns87415.c
pata_octeon_cf.c
pata_of_platform.c
pata_oldpiix.c
pata_opti.c
pata_optidma.c
pata_palmld.c
pata_pcmcia.c
pata_pdc202xx_old.c
pata_pdc2027x.c
pata_piccolo.c
pata_platform.c
pata_pxa.c ata: pata_pxa: dmaengine conversion 2015-09-10 17:02:04 -04:00
pata_radisys.c
pata_rb532_cf.c pata-rb532-cf: get rid of the irq_to_gpio() call 2016-02-18 11:26:27 -05:00
pata_rdc.c
pata_rz1000.c
pata_samsung_cf.c libata: samsung_cf: fix handling platform_get_irq result 2015-09-25 11:50:15 -04:00
pata_sc1200.c
pata_sch.c
pata_serverworks.c
pata_sil680.c
pata_sis.c
pata_sl82c105.c
pata_triflex.c
pata_via.c
pdc_adma.c
sata_dwc_460ex.c ata: sata_dwc_460ex: make debug messages neat 2016-05-12 10:54:12 -04:00
sata_fsl.c ata/sata_fsl.c: add ATA_FLAG_NO_LOG_PAGE to blacklist the controller for log page reads 2015-12-07 10:25:57 -05:00
sata_highbank.c remove lots of IS_ERR_VALUE abuses 2016-05-27 15:26:11 -07:00
sata_inic162x.c
sata_mv.c
sata_nv.c
sata_promise.c
sata_promise.h
sata_qstor.c
sata_rcar.c ata: sata_rcar: Remove obsolete platform_device_id entries 2015-11-24 09:54:36 -05:00
sata_sil.c sata_sil: disable trim 2015-11-30 10:02:49 -05:00
sata_sil24.c
sata_sis.c
sata_svw.c
sata_sx4.c sata_sx4: correctly handling failed allocation 2015-12-31 21:33:42 -05:00
sata_uli.c
sata_via.c sata_via: Implement hotplug for VT6421 2016-02-25 13:22:16 -05:00
sata_vsc.c
sis.h