1
0
Fork 0
alistair23-linux/drivers/scsi/esas2r
Nathan Chancellor 6f4e626fb0 scsi: ata: Use unsigned int for cmd's type in ioctls in scsi_host_template
Clang warns several times in the scsi subsystem (trimmed for brevity):

drivers/scsi/hpsa.c:6209:7: warning: overflow converting case value to
switch condition type (2147762695 to 18446744071562347015) [-Wswitch]
        case CCISS_GETBUSTYPES:
             ^
drivers/scsi/hpsa.c:6208:7: warning: overflow converting case value to
switch condition type (2147762694 to 18446744071562347014) [-Wswitch]
        case CCISS_GETHEARTBEAT:
             ^

The root cause is that the _IOC macro can generate really large numbers,
which don't fit into type 'int', which is used for the cmd parameter in
the ioctls in scsi_host_template. My research into how GCC and Clang are
handling this at a low level didn't prove fruitful. However, looking at
the rest of the kernel tree, all ioctls use an 'unsigned int' for the
cmd parameter, which will fit all of the _IOC values in the scsi/ata
subsystems.

Make that change because none of the ioctls expect a negative value for
any command, it brings the ioctls inline with the reset of the kernel,
and it removes ambiguity, which is never good when dealing with compilers.

Link: https://github.com/ClangBuiltLinux/linux/issues/85
Link: https://github.com/ClangBuiltLinux/linux/issues/154
Link: https://github.com/ClangBuiltLinux/linux/issues/157
Signed-off-by: Nathan Chancellor <natechancellor@gmail.com>
Acked-by: Bradley Grove <bgrove@attotech.com>
Acked-by: Don Brace <don.brace@microsemi.com>
Reviewed-by: Bart Van Assche <bvanassche@acm.org>
Tested-by: Nick Desaulniers <ndesaulniers@google.com>
Reviewed-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
2019-02-08 17:33:00 -05:00
..
Kconfig
Makefile
atioctl.h
atvda.h
esas2r.h scsi: ata: Use unsigned int for cmd's type in ioctls in scsi_host_template 2019-02-08 17:33:00 -05:00
esas2r_disc.c [SCSI] esas2r: Directly call kernel functions for atomic bit operations 2013-10-25 09:58:59 +01:00
esas2r_flash.c esas2r: Correct typos of "validate" in a comment 2014-12-04 09:58:33 +01:00
esas2r_init.c scsi: esas2r: esas2r_init: mark expected switch fall-throughs 2019-01-11 21:45:06 -05:00
esas2r_int.c [SCSI] esas2r: Directly call kernel functions for atomic bit operations 2013-10-25 09:58:59 +01:00
esas2r_io.c [SCSI] esas2r: Directly call kernel functions for atomic bit operations 2013-10-25 09:58:59 +01:00
esas2r_ioctl.c scsi: ata: Use unsigned int for cmd's type in ioctls in scsi_host_template 2019-02-08 17:33:00 -05:00
esas2r_log.c scsi: esas2r: Remove redundant NULL check on buffer 2017-03-16 19:49:45 -04:00
esas2r_log.h scsi: esas2r: Fix format string type mistakes 2017-01-09 23:52:26 -05:00
esas2r_main.c scsi: ata: Use unsigned int for cmd's type in ioctls in scsi_host_template 2019-02-08 17:33:00 -05:00
esas2r_targdb.c [SCSI] esas2r: Directly call kernel functions for atomic bit operations 2013-10-25 09:58:59 +01:00
esas2r_vda.c [SCSI] esas2r: Cleanup snprinf formatting of firmware version 2013-10-25 09:58:59 +01:00