Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752056AbdFSUXs (ORCPT ); Mon, 19 Jun 2017 16:23:48 -0400 Received: from mx2.suse.de ([195.135.220.15]:49798 "EHLO mx1.suse.de" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1750930AbdFSUXq (ORCPT ); Mon, 19 Jun 2017 16:23:46 -0400 Subject: Re: [PATCH] mm: remove a redundant condition in the for loop To: Rasmus Villemoes Cc: Hao Lee , akpm@linux-foundation.org, mgorman@techsingularity.net, mhocko@suse.com, hannes@cmpxchg.org, iamjoonsoo.kim@lge.com, minchan@kernel.org, linux-mm@kvack.org, linux-kernel@vger.kernel.org References: <20170619135418.8580-1-haolee.swjtu@gmail.com> <87y3snajd2.fsf@rasmusvillemoes.dk> From: Vlastimil Babka Message-ID: <73d7a087-1a5d-57ba-7026-5756b8a92381@suse.cz> Date: Mon, 19 Jun 2017 22:23:03 +0200 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.1.1 MIME-Version: 1.0 In-Reply-To: <87y3snajd2.fsf@rasmusvillemoes.dk> Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 647 Lines: 19 On 06/19/2017 09:05 PM, Rasmus Villemoes wrote: > On Mon, Jun 19 2017, Vlastimil Babka wrote: > >> On 06/19/2017 03:54 PM, Hao Lee wrote: >>> The variable current_order decreases from MAX_ORDER-1 to order, so the >>> condition current_order <= MAX_ORDER-1 is always true. >>> >>> Signed-off-by: Hao Lee >> >> Sounds right. >> >> Acked-by: Vlastimil Babka > > current_order and order are both unsigned, and if order==0, > current_order >= order is always true, and we may decrement > current_order past 0 making it UINT_MAX... A comment would be in order, > though. Doh, right. Thanks.