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:01:21 +0000 (04:01 +0900)
commitdfb1bb02c5a37c6a3f59c8ad752cd8e46d10ad4b
tree277d868a566d2a64a3d16534fb2e14d708c72934
parent13cd95296c111d8e303514b5b4c716ebe1fe9155
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