]> git.baikalelectronics.ru Git - kernel.git/commit
slimbus: Fix out-of-bounds access in slim_slicesize()
authorGeert Uytterhoeven <geert@linux-m68k.org>
Sun, 8 Apr 2018 09:02:34 +0000 (11:02 +0200)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Mon, 23 Apr 2018 11:40:15 +0000 (13:40 +0200)
commit76316287e6fceac89dd7307f0cf7177eaf59e18e
tree2e7435326efad5203215da05726c69c5696498be
parent8a0dbc44adb1a36690d908327aad6428eb572ea5
slimbus: Fix out-of-bounds access in slim_slicesize()

With gcc-4.1.2:

    slimbus/messaging.c: In function ‘slim_slicesize’:
    slimbus/messaging.c:186: warning: statement with no effect

Indeed, clamp() is a macro not operating in-place, but returning the
clamped value.  Hence the value is not clamped at all, which may lead to
an out-of-bounds access.

Fix this by assigning the clamped value.

Fixes: 60cf1bfc75c6dab1 ("slimbus: Add messaging APIs to slimbus framework")
Signed-off-by: Geert Uytterhoeven <geert@linux-m68k.org>
Cc: stable <stable@vger.kernel.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/slimbus/messaging.c