From: Christoph Hellwig <hch@infradead.org>
To: Nathan Chancellor <natechancellor@gmail.com>
Cc: Jens Axboe <axboe@kernel.dk>,
"James E.J. Bottomley" <jejb@linux.ibm.com>,
"Martin K. Petersen" <martin.petersen@oracle.com>,
"Manoj N. Kumar" <manoj@linux.ibm.com>,
"Matthew R. Ochs" <mrochs@linux.ibm.com>,
Uma Krishnan <ukrishn@linux.ibm.com>,
Brian King <brking@us.ibm.com>,
Adaptec OEM Raid Solutions <aacraid@microsemi.com>,
Marc Gonzalez <marc.w.gonzalez@free.fr>,
linux-ide@vger.kernel.org, linux-kernel@vger.kernel.org,
linux-scsi@vger.kernel.org, esc.storagedev@microsemi.com,
Bradley Grove <bgrove@attotech.com>,
Don Brace <don.brace@microsemi.com>,
Bart Van Assche <bvanassche@acm.org>,
Nick Desaulniers <ndesaulniers@google.com>
Subject: Re: [PATCH v5] scsi/ata: Use unsigned int for cmd's type in ioctls in scsi_host_template
Date: Fri, 8 Feb 2019 00:05:01 -0800 [thread overview]
Message-ID: <20190208080501.GA18530@infradead.org> (raw)
In-Reply-To: <20190207160719.28895-1-natechancellor@gmail.com>
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@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>
Looks good:
Reviewed-by: Christoph Hellwig <hch@lst.de>
next prev parent reply other threads:[~2019-02-08 8:05 UTC|newest]
Thread overview: 18+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-10-19 17:57 [PATCH] scsi/ata: Use unsigned int for cmd's type in ioctls in scsi_host_template Nathan Chancellor
2018-10-19 19:38 ` Bart Van Assche
2018-10-20 4:52 ` kbuild test robot
2018-10-20 5:01 ` [PATCH v2] " Nathan Chancellor
2018-12-17 17:31 ` Nathan Chancellor
2019-01-14 4:42 ` [PATCH v3] " Nathan Chancellor
2019-01-14 4:54 ` Bart Van Assche
2019-01-14 4:57 ` Nathan Chancellor
2019-01-26 7:52 ` [PATCH v4] " Nathan Chancellor
2019-01-26 9:19 ` Nick Desaulniers
2019-01-28 16:16 ` Don.Brace
2019-01-28 16:17 ` Nathan Chancellor
2019-02-05 18:42 ` Grove, Bradley
2019-02-07 16:07 ` [PATCH v5] " Nathan Chancellor
2019-02-07 19:17 ` Nick Desaulniers
2019-02-08 8:05 ` Christoph Hellwig [this message]
2019-02-08 16:00 ` Nathan Chancellor
2019-02-08 22:33 ` Martin K. Petersen
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20190208080501.GA18530@infradead.org \
--to=hch@infradead.org \
--cc=aacraid@microsemi.com \
--cc=axboe@kernel.dk \
--cc=bgrove@attotech.com \
--cc=brking@us.ibm.com \
--cc=bvanassche@acm.org \
--cc=don.brace@microsemi.com \
--cc=esc.storagedev@microsemi.com \
--cc=jejb@linux.ibm.com \
--cc=linux-ide@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-scsi@vger.kernel.org \
--cc=manoj@linux.ibm.com \
--cc=marc.w.gonzalez@free.fr \
--cc=martin.petersen@oracle.com \
--cc=mrochs@linux.ibm.com \
--cc=natechancellor@gmail.com \
--cc=ndesaulniers@google.com \
--cc=ukrishn@linux.ibm.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).