]> git.proxmox.com Git - mirror_ubuntu-bionic-kernel.git/commit
mISDN: Fix type of switch control variable in ctrl_teimanager
authorNathan Chancellor <natechancellor@gmail.com>
Fri, 19 Oct 2018 18:00:30 +0000 (11:00 -0700)
committerMarcelo Henrique Cerri <marcelo.cerri@canonical.com>
Fri, 17 Jan 2020 17:20:54 +0000 (14:20 -0300)
commitf83c8f780a2d1bc391c9b6045628e74623fd9695
treeebcfbfbe686803be908f363824db0a47c681dc6d
parent1f67a059d340a683f10003fbff6e6c2c99a9284c
mISDN: Fix type of switch control variable in ctrl_teimanager

BugLink: https://bugs.launchpad.net/bugs/1854975
[ Upstream commit aeb5e02aca91522733eb1db595ac607d30c87767 ]

Clang warns (trimmed for brevity):

drivers/isdn/mISDN/tei.c:1193:7: warning: overflow converting case value
to switch condition type (2147764552 to 18446744071562348872) [-Wswitch]
        case IMHOLD_L1:
             ^
drivers/isdn/mISDN/tei.c:1187:7: warning: overflow converting case value
to switch condition type (2147764550 to 18446744071562348870) [-Wswitch]
        case IMCLEAR_L2:
             ^
2 warnings generated.

The root cause is that the _IOC macro can generate really large numbers,
which don't find into type int. My research into how GCC and Clang are
handling this at a low level didn't prove fruitful and surveying the
kernel tree shows that aside from here and a few places in the scsi
subsystem, everything that uses _IOC is at least of type 'unsigned int'.
Make that change here because as nothing in this function cares about
the signedness of the variable and it removes ambiguity, which is never
good when dealing with compilers.

While we're here, remove the unnecessary local variable ret (just return
-EINVAL and 0 directly).

Link: https://github.com/ClangBuiltLinux/linux/issues/67
Signed-off-by: Nathan Chancellor <natechancellor@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Signed-off-by: Sasha Levin <sashal@kernel.org>
Signed-off-by: Kamal Mostafa <kamal@canonical.com>
Signed-off-by: Kleber Sacilotto de Souza <kleber.souza@canonical.com>
drivers/isdn/mISDN/tei.c