[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <1524217551.3321.4.camel@linux.vnet.ibm.com>
Date: Fri, 20 Apr 2018 11:45:51 +0200
From: James Bottomley <jejb@...ux.vnet.ibm.com>
To: Colin King <colin.king@...onical.com>,
Intel SCU Linux support <intel-linux-scu@...el.com>,
Artur Paszkiewicz <artur.paszkiewicz@...el.com>,
"Martin K . Petersen" <martin.petersen@...cle.com>,
linux-scsi@...r.kernel.org
Cc: kernel-janitors@...r.kernel.org, linux-kernel@...r.kernel.org
Subject: Re: [PATCH] isci: Fix infinite loop in while loop
On Fri, 2018-04-20 at 10:03 +0100, Colin King wrote:
> From: Colin Ian King <colin.king@...onical.com>
>
> 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
> jumping to the increment of phy_index.
>
> [ The goto is used to save one more level of nesting that
> makes the code far wider than 80 columns. ]
what's wrong with replacing the while() with a for() that just works
(removing the increment at the end). This is effectively open coding a
for loop anyway, which is a pattern we wouldn't want replicated.
James
Powered by blists - more mailing lists