[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20190208080501.GA18530@infradead.org>
Date: Fri, 8 Feb 2019 00:05:01 -0800
From: Christoph Hellwig <hch@...radead.org>
To: Nathan Chancellor <natechancellor@...il.com>
Cc: Jens Axboe <axboe@...nel.dk>,
"James E.J. Bottomley" <jejb@...ux.ibm.com>,
"Martin K. Petersen" <martin.petersen@...cle.com>,
"Manoj N. Kumar" <manoj@...ux.ibm.com>,
"Matthew R. Ochs" <mrochs@...ux.ibm.com>,
Uma Krishnan <ukrishn@...ux.ibm.com>,
Brian King <brking@...ibm.com>,
Adaptec OEM Raid Solutions <aacraid@...rosemi.com>,
Marc Gonzalez <marc.w.gonzalez@...e.fr>,
linux-ide@...r.kernel.org, linux-kernel@...r.kernel.org,
linux-scsi@...r.kernel.org, esc.storagedev@...rosemi.com,
Bradley Grove <bgrove@...otech.com>,
Don Brace <don.brace@...rosemi.com>,
Bart Van Assche <bvanassche@....org>,
Nick Desaulniers <ndesaulniers@...gle.com>
Subject: Re: [PATCH v5] scsi/ata: Use unsigned int for cmd's type in ioctls
in scsi_host_template
On Thu, Feb 07, 2019 at 09:07:20AM -0700, Nathan Chancellor wrote:
> 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@...il.com>
> Acked-by: Bradley Grove <bgrove@...otech.com>
> Acked-by: Don Brace <don.brace@...rosemi.com>
> Reviewed-by: Bart Van Assche <bvanassche@....org>
> Tested-by: Nick Desaulniers <ndesaulniers@...gle.com>
Looks good:
Reviewed-by: Christoph Hellwig <hch@....de>
Powered by blists - more mailing lists