scsi: sym53c8xx_2: iterator underflow in sym_getsync()
authorDan Carpenter <dan.carpenter@oracle.com>
Thu, 25 Jan 2018 14:13:40 +0000 (17:13 +0300)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Fri, 25 May 2018 14:13:06 +0000 (16:13 +0200)
commit13a3e883ce6f2c740b4e75c1f907792fab493470
treefe2e8adbd0b6b77ee05e1b9be6e46d0d09d062e3
parentac6572952cbbac58381636a7e28cb57fffe90adb
scsi: sym53c8xx_2: iterator underflow in sym_getsync()

[ Upstream commit e6f791d95313c85f3dd4a26141e28e50ae9aa0ae ]

We wanted to exit the loop with "div" set to zero, but instead, if we
don't hit the break then "div" is -1 when we finish the loop.  It leads
to an array underflow a few lines later.

Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
Reviewed-by: Johannes Thumshirn <jthumshirn@suse.de>
Acked-by: Matthew Wilcox <mawilcox@microsoft.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
Signed-off-by: Sasha Levin <alexander.levin@microsoft.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/scsi/sym53c8xx_2/sym_hipd.c