Received: by 10.192.165.148 with SMTP id m20csp47820imm; Fri, 20 Apr 2018 02:48:39 -0700 (PDT) X-Google-Smtp-Source: AIpwx4/iT6suIhRrLeMRls1FJ7peFekdRciDMHvhYQ3mzMUfymUDA0SytxbY/gGrLI3B4b+Obavp X-Received: by 10.101.88.140 with SMTP id d12mr7906504pgu.408.1524217719039; Fri, 20 Apr 2018 02:48:39 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1524217719; cv=none; d=google.com; s=arc-20160816; b=LD9zSxSjSxJMqszJ+kkLB4pj8Kjc9SpqVn+RAYUpiNcjjjsdKxKL24mtLD2GFz3vNS BtmSdnNyNZT5AdVkJsIp84XLl6+KK/ejsdkWEbmcPxWodgdvFuhnnXjosO2ecx1glt7j wF6a1XuAZYYfowO32bQOW0UISWLcMw+33KevEWOlXad+v+2E7Qv4X/ACqpI1W5OuNd3S Flb8ckfghVbv9KGlh7Jxnn5ezYlidKAn8TzygJJ2PfwU5xacSPOhXm1KhA+NSYpwPnzP MKMcejj5299yEEoeceEHW93nanjaRKZqTtBXB8E9WXUp3UAt+5y+U4vivdz6o9RXuKK+ qSVg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:message-id:content-transfer-encoding :mime-version:references:in-reply-to:date:cc:to:from:subject :arc-authentication-results; bh=oPjzagTLx9yhNjcfrFgPxVBKrdtVeBgzwaJnoDjHbt4=; b=rAlOR2fZ8zXTNdYXUfQ5XnnyosWf9/3xqIW177E1rrozKx8lJglX7W/opEiDjN27lx vmWzEfJarTP1KhVg4kF/+1+VY6nu5MxK7gpK+/ymbPBlGMupSuSBjF7EVMXXeDT6Te5E CwMSNopUFIyGugmDDj+DR+yZLBbuZonte/k298U1kpnjJTwDnwfzOIQh0kYs9gBFUmfo 6OIqwPuSTVAPaTNhTXd3YmsrCVWfEy6lJaw0OxPLU58mE+KTCGUJT3r4wZCzT6xFCJai sxpci1IEePsOkAw+P6I1NYJkmiu4DEYZUf/E4HzGNhPPcsRCNHXofBdP+fKXzPT1bpRr lDsA== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=ibm.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id q9si4886131pff.109.2018.04.20.02.48.24; Fri, 20 Apr 2018 02:48:38 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=ibm.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754399AbeDTJqD (ORCPT + 99 others); Fri, 20 Apr 2018 05:46:03 -0400 Received: from mx0a-001b2d01.pphosted.com ([148.163.156.1]:52084 "EHLO mx0a-001b2d01.pphosted.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754194AbeDTJqC (ORCPT ); Fri, 20 Apr 2018 05:46:02 -0400 Received: from pps.filterd (m0098393.ppops.net [127.0.0.1]) by mx0a-001b2d01.pphosted.com (8.16.0.22/8.16.0.22) with SMTP id w3K9jp5C032516 for ; Fri, 20 Apr 2018 05:46:01 -0400 Received: from e31.co.us.ibm.com (e31.co.us.ibm.com [32.97.110.149]) by mx0a-001b2d01.pphosted.com with ESMTP id 2hfasc7xep-1 (version=TLSv1.2 cipher=AES256-SHA256 bits=256 verify=NOT) for ; Fri, 20 Apr 2018 05:46:01 -0400 Received: from localhost by e31.co.us.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Fri, 20 Apr 2018 03:46:00 -0600 Received: from b03cxnp07028.gho.boulder.ibm.com (9.17.130.15) by e31.co.us.ibm.com (192.168.1.131) with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted; Fri, 20 Apr 2018 03:45:58 -0600 Received: from b03ledav006.gho.boulder.ibm.com (b03ledav006.gho.boulder.ibm.com [9.17.130.237]) by b03cxnp07028.gho.boulder.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id w3K9jvWr12845354; Fri, 20 Apr 2018 02:45:58 -0700 Received: from b03ledav006.gho.boulder.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id E2DFBC6047; Fri, 20 Apr 2018 03:45:57 -0600 (MDT) Received: from jarvis.ext.hansenpartnership.com (unknown [9.80.236.4]) by b03ledav006.gho.boulder.ibm.com (Postfix) with ESMTPS id 08763C603E; Fri, 20 Apr 2018 03:45:54 -0600 (MDT) Subject: Re: [PATCH] isci: Fix infinite loop in while loop From: James Bottomley To: Colin King , Intel SCU Linux support , Artur Paszkiewicz , "Martin K . Petersen" , linux-scsi@vger.kernel.org Cc: kernel-janitors@vger.kernel.org, linux-kernel@vger.kernel.org Date: Fri, 20 Apr 2018 11:45:51 +0200 In-Reply-To: <20180420090310.714-1-colin.king@canonical.com> References: <20180420090310.714-1-colin.king@canonical.com> Content-Type: text/plain; charset="UTF-8" X-Mailer: Evolution 3.22.6 Mime-Version: 1.0 Content-Transfer-Encoding: 7bit X-TM-AS-GCONF: 00 x-cbid: 18042009-8235-0000-0000-00000D576DB5 X-IBM-SpamModules-Scores: X-IBM-SpamModules-Versions: BY=3.00008888; HX=3.00000241; KW=3.00000007; PH=3.00000004; SC=3.00000257; SDB=6.01020593; UDB=6.00520764; IPR=6.00799830; MB=3.00020682; MTD=3.00000008; XFM=3.00000015; UTC=2018-04-20 09:46:00 X-IBM-AV-DETECTION: SAVI=unused REMOTE=unused XFE=unused x-cbparentid: 18042009-8236-0000-0000-00004090A012 Message-Id: <1524217551.3321.4.camel@linux.vnet.ibm.com> X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10434:,, definitions=2018-04-20_04:,, signatures=0 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 priorityscore=1501 malwarescore=0 suspectscore=0 phishscore=0 bulkscore=0 spamscore=0 clxscore=1011 lowpriorityscore=0 impostorscore=0 adultscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.0.1-1709140000 definitions=main-1804200096 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Fri, 2018-04-20 at 10:03 +0100, Colin King wrote: > From: Colin Ian King > > 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