patch "slimbus: Fix out-of-bounds access in slim_slicesize()" added to char-misc-linus
Subsystems (2)
This is a note to let you know that I've just added the patch titled
slimbus: Fix out-of-bounds access in slim_slicesize()
to my char-misc git tree which can be found at
git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/char-misc.git
in the char-misc-linus branch.
The patch will show up in the next release of the linux-next tree (usually sometime within the next 24 hours during the week.)
The patch will hopefully also be merged in Linus's tree for the next -rc kernel release.
If you have any questions about this process, please let me know.
Quoted 1 line
From
e33bbe69149b802c0c77bfb822685772f85388caMon Sep 17 00:00:00 2001
From: Geert Uytterhoeven <[email protected]>
Date: Sun, 8 Apr 2018 11:02:34 +0200
Subject: slimbus: Fix out-of-bounds access in slim_slicesize()
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
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.
--- drivers/slimbus/messaging.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/slimbus/messaging.c +1 -1
@@ -183,7 +183,7 @@ static u16 slim_slicesize(int code)0 ,1 ,2 ,3 ,3 ,4 ,4 ,5 ,5 ,5 ,5 ,6 ,6 ,6 ,6 ,7 }; -clamp (code,1 , (int )ARRAY_SIZE (sizetocode)); + code =clamp (code,1 , (int )ARRAY_SIZE (sizetocode));return sizetocode[code -1 ]; }
Signature · 1 line
2.17.0