]> git.proxmox.com Git - mirror_ubuntu-eoan-kernel.git/commit
staging/slicoss: Fix buffer possible overflow in slic_card_locate
authorPeter Huewe <peterhuewe@gmx.de>
Tue, 19 Feb 2013 04:18:51 +0000 (05:18 +0100)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Mon, 11 Mar 2013 16:22:44 +0000 (09:22 -0700)
commit20d403e801272b84e033b8f17d3e45c4f66507c7
tree12b8fe2841c53680ecc735695632f3fc4a2a1690
parent6d1b80fd886937ad4d6169ffa78cb0075eebce53
staging/slicoss: Fix buffer possible overflow in slic_card_locate

smatch complains about a possible buffer overflow
slicoss.c:3651 slic_card_locate() error: buffer overflow
'physcard->adapter' 4 <= 4

If the for loop is not exited prematurely i++ is executed after the last
iteration and thus i can be 4, which is out of bounds for
physcard->adapter.

-> Add check for this condition and simplify the if statement by
inverting the condition.

Signed-off-by: Peter Huewe <peterhuewe@gmx.de>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/staging/slicoss/slicoss.c