Received: by 2002:a25:683:0:0:0:0:0 with SMTP id 125csp563150ybg; Tue, 9 Jun 2020 07:26:34 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxKqFZOofDuTBaAvRbmjFF2QQ7G00i15MPVd8yOr+gExjuwD0HhwmaHdbjZI2cggXlinua9 X-Received: by 2002:a17:906:8253:: with SMTP id f19mr26546701ejx.470.1591712794569; Tue, 09 Jun 2020 07:26:34 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1591712794; cv=none; d=google.com; s=arc-20160816; b=V7Ss2ZkA5cNOxWsqcTgoX7FnWG4ihomGh6aimhfekNoQJrNfoyvpgLd7OHyIMtsFkX M8T/Q5DgcZMo/MfnOtUdeLTbPKgS/jlQVveBdhZcdhrXcSCdjym6Kpr00/RRA0lcoiFx Qh0jg8ocD/ZZ8roKEokxk4e6n2AZssHUKVGh5icPmO5pr24NgH05FRqsr0aJbzm8XM4A /5s7lfO6xbA3VhERA55O515dluF9R36LqNJAKsGDDThV3otEpVWYz4/Cah5wivXQzdwW Zl+x6I2BL6DKMf/R+MUmhh4X2AilvBKlVS9L7xg83YUl1kQMJ5OQDtmcukr4amG1LneO bTug== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-disposition:mime-version:references:message-id:subject:cc :to:from:date; bh=CQXduG1+MxrYM9O+kMkFevcodPKMemwbUQadFIqOtsI=; b=hQyt9LDffsprEcHGjlEPzxkJdPxOmHevdYj8OySDA9ZJwH20oEvCVovuPg/4juZBt4 mR+yJmWnKegug8atuMjSUqQn7+CBCSwWqI1ALghmrhTHhvhJAVRvcnVPHmi+eSTYnqhP wLpo2nzp5vO5qljBW2QCuEIjDYIeXnVFgeQ1QeQDhAyq1cV8FeWx3+hURjjfYwWFo61T mZ65H2f4IOkNUAynKUNg4VH8oGSN+OzkUYlMgphDOBdMeTPY67pinfEgPbuykoZg7g8R e+S6ghtODZjdIJE4Z99EHM2oITahGqyqBD+yXjLOghnmYq0iaKPkz9YF+0i1iQxxxnF0 aD5w== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 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. [23.128.96.18]) by mx.google.com with ESMTP id f7si10731591ejr.406.2020.06.09.07.26.11; Tue, 09 Jun 2020 07:26:34 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 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 S1730243AbgFIOX0 (ORCPT + 99 others); Tue, 9 Jun 2020 10:23:26 -0400 Received: from mx0a-001b2d01.pphosted.com ([148.163.156.1]:47842 "EHLO mx0a-001b2d01.pphosted.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726967AbgFIOXZ (ORCPT ); Tue, 9 Jun 2020 10:23:25 -0400 Received: from pps.filterd (m0098394.ppops.net [127.0.0.1]) by mx0a-001b2d01.pphosted.com (8.16.0.42/8.16.0.42) with SMTP id 059E44GR047427; Tue, 9 Jun 2020 10:23:23 -0400 Received: from pps.reinject (localhost [127.0.0.1]) by mx0a-001b2d01.pphosted.com with ESMTP id 31jayd2qq5-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Tue, 09 Jun 2020 10:23:23 -0400 Received: from m0098394.ppops.net (m0098394.ppops.net [127.0.0.1]) by pps.reinject (8.16.0.36/8.16.0.36) with SMTP id 059E4cWQ055957; Tue, 9 Jun 2020 10:23:23 -0400 Received: from ppma01fra.de.ibm.com (46.49.7a9f.ip4.static.sl-reverse.com [159.122.73.70]) by mx0a-001b2d01.pphosted.com with ESMTP id 31jayd2qp0-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Tue, 09 Jun 2020 10:23:23 -0400 Received: from pps.filterd (ppma01fra.de.ibm.com [127.0.0.1]) by ppma01fra.de.ibm.com (8.16.0.42/8.16.0.42) with SMTP id 059ELJeE012234; Tue, 9 Jun 2020 14:23:20 GMT Received: from b06cxnps3074.portsmouth.uk.ibm.com (d06relay09.portsmouth.uk.ibm.com [9.149.109.194]) by ppma01fra.de.ibm.com with ESMTP id 31g2s7tgfk-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Tue, 09 Jun 2020 14:23:20 +0000 Received: from d06av25.portsmouth.uk.ibm.com (d06av25.portsmouth.uk.ibm.com [9.149.105.61]) by b06cxnps3074.portsmouth.uk.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id 059ENIxe9437552 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Tue, 9 Jun 2020 14:23:18 GMT Received: from d06av25.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 6EE4811C050; Tue, 9 Jun 2020 14:23:18 +0000 (GMT) Received: from d06av25.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 2734911C052; Tue, 9 Jun 2020 14:23:18 +0000 (GMT) Received: from oc3871087118.ibm.com (unknown [9.145.154.183]) by d06av25.portsmouth.uk.ibm.com (Postfix) with ESMTPS; Tue, 9 Jun 2020 14:23:18 +0000 (GMT) Date: Tue, 9 Jun 2020 16:23:16 +0200 From: Alexander Gordeev To: Andy Shevchenko Cc: Andrew Morton , linux-kernel@vger.kernel.org, yury.norov@gmail.com Subject: Re: [PATCH v1] lib/bitmap: Convert infinite while loop to for one Message-ID: <20200609142316.GA7558@oc3871087118.ibm.com> References: <20200609140535.87160-1-andriy.shevchenko@linux.intel.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20200609140535.87160-1-andriy.shevchenko@linux.intel.com> User-Agent: Mutt/1.5.21 (2010-09-15) X-TM-AS-GCONF: 00 X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10434:6.0.216,18.0.687 definitions=2020-06-09_06:2020-06-09,2020-06-09 signatures=0 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 mlxlogscore=999 spamscore=0 priorityscore=1501 lowpriorityscore=0 suspectscore=0 bulkscore=0 impostorscore=0 mlxscore=0 phishscore=0 adultscore=0 cotscore=-2147483648 malwarescore=0 clxscore=1015 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2004280000 definitions=main-2006090107 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tue, Jun 09, 2020 at 05:05:35PM +0300, Andy Shevchenko wrote: > Convert infinite while loop to for one in order to be more explicit > in one place what we are doing with chunks. Reviewed-by: Alexander Gordeev > > Signed-off-by: Andy Shevchenko > --- > > Andrew, this can be folded to the fix > > lib/bitmap.c | 5 ++--- > 1 file changed, 2 insertions(+), 3 deletions(-) > > diff --git a/lib/bitmap.c b/lib/bitmap.c > index 10f8fa0497e3..03ef42fbe658 100644 > --- a/lib/bitmap.c > +++ b/lib/bitmap.c > @@ -740,10 +740,10 @@ int bitmap_parse(const char *start, unsigned int buflen, > const char *end = strnchrnul(start, buflen, '\n') - 1; > int chunks = BITS_TO_U32(nmaskbits); > u32 *bitmap = (u32 *)maskp; > - int chunk = 0; > int unset_bit; > + int chunk; > > - while (1) { > + for (chunk = 0; ; chunk++) { > end = bitmap_find_region_reverse(start, end); > if (start > end) > break; > @@ -758,7 +758,6 @@ int bitmap_parse(const char *start, unsigned int buflen, > #endif > if (IS_ERR(end)) > return PTR_ERR(end); > - chunk++; > } > > unset_bit = (BITS_TO_U32(nmaskbits) - chunks) * 32; > -- > 2.27.0.rc2 >