UPSTREAM: arm64: module: avoid undefined shift behavior in reloc_data()
authorArd Biesheuvel <ard.biesheuvel@linaro.org>
Tue, 5 Jan 2016 09:18:52 +0000 (10:18 +0100)
committerDmitry Shmidt <dimitrysh@google.com>
Tue, 31 May 2016 20:26:37 +0000 (13:26 -0700)
commitd8853fd2e900115923bb36a9137d6b3f1095ee70
tree4d59ae4371534ae3236304d9c726d75cc85cbcbe
parentef55b4532be92094b0a1f03f2e1a50d4b49a30ae
UPSTREAM: arm64: module: avoid undefined shift behavior in reloc_data()

Compilers may engage the improbability drive when encountering shifts
by a distance that is a multiple of the size of the operand type. Since
the required bounds check is very simple here, we can get rid of all the
fuzzy masking, shifting and comparing, and use the documented bounds
directly.

Change-Id: Ibc1b73f4a630bc182deb6edfa7458b5e29ba9577
Reported-by: David Binderman <dcb314@hotmail.com>
Signed-off-by: Ard Biesheuvel <ard.biesheuvel@linaro.org>
Signed-off-by: Will Deacon <will.deacon@arm.com>
arch/arm64/kernel/module.c