scsi: isci: Fix infinite loop in while loop
authorColin Ian King <colin.king@canonical.com>
Fri, 20 Apr 2018 09:57:16 +0000 (10:57 +0100)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Wed, 20 Jun 2018 19:02:46 +0000 (04:02 +0900)
commit6385f2da8b3bda687ae5e9f7c60655cfeb16632a
treed6ccdac0b4c86990c357fd748b4b9a63b10d208b
parent12f9bb1a273e29c0b51b5894803f8076dc5e4a8e
scsi: isci: Fix infinite loop in while loop

[ Upstream commit 4bc83b3f272fe8f36450f9c003df49cf07ffe5fd ]

In the case when the phy_mask is bitwise anded with the phy_index bit is
zero the continue statement currently jumps to the next iteration of the
while loop and phy_index is never actually incremented, potentially
causing an infinite loop if phy_index is less than SCI_MAX_PHS. Fix this
by turning the while loop into a for loop.

Signed-off-by: Colin Ian King <colin.king@canonical.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/isci/port_config.c