diff options
| author | Nathan Chancellor <[email protected]> | 2019-02-07 16:07:20 +0000 |
|---|---|---|
| committer | Martin K. Petersen <[email protected]> | 2019-02-08 22:33:00 +0000 |
| commit | 6f4e626fb0cc93d50b49b79c2ee33bd769ee57f0 (patch) | |
| tree | bd3d49a1ad35778fd6f527668ce304b8c69ae936 /drivers/scsi/libsas/sas_scsi_host.c | |
| parent | scsi: lpfc: Update lpfc version to 12.2.0.0 (diff) | |
| download | kernel-6f4e626fb0cc93d50b49b79c2ee33bd769ee57f0.tar.gz kernel-6f4e626fb0cc93d50b49b79c2ee33bd769ee57f0.zip | |
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 <[email protected]>
Acked-by: Bradley Grove <[email protected]>
Acked-by: Don Brace <[email protected]>
Reviewed-by: Bart Van Assche <[email protected]>
Tested-by: Nick Desaulniers <[email protected]>
Reviewed-by: Christoph Hellwig <[email protected]>
Signed-off-by: Martin K. Petersen <[email protected]>
Diffstat (limited to 'drivers/scsi/libsas/sas_scsi_host.c')
| -rw-r--r-- | drivers/scsi/libsas/sas_scsi_host.c | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/drivers/scsi/libsas/sas_scsi_host.c b/drivers/scsi/libsas/sas_scsi_host.c index c43a00a9d819..b775445892af 100644 --- a/drivers/scsi/libsas/sas_scsi_host.c +++ b/drivers/scsi/libsas/sas_scsi_host.c @@ -799,7 +799,7 @@ out: shost->host_failed, tries); } -int sas_ioctl(struct scsi_device *sdev, int cmd, void __user *arg) +int sas_ioctl(struct scsi_device *sdev, unsigned int cmd, void __user *arg) { struct domain_device *dev = sdev_to_domain_dev(sdev); |
