Received: by 2002:a25:31c3:0:0:0:0:0 with SMTP id x186csp6004326ybx; Mon, 11 Nov 2019 02:14:29 -0800 (PST) X-Google-Smtp-Source: APXvYqwDiaCnGjqENU0nmzekqobIBsm8Sdl9J6oVBQMlX4l4qOXlklDHT9HSMyCmSaRHHWKTZyht X-Received: by 2002:a50:b685:: with SMTP id d5mr25703731ede.276.1573467269281; Mon, 11 Nov 2019 02:14:29 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1573467269; cv=none; d=google.com; s=arc-20160816; b=unM7cmIOTYK6plNkzyDLH3mKmgEC6ugUMzQ8Bn2RtVI8zU+myxYGDfhN5DpM/cSm1M xOd/H0zDnyBCSzG2kvCBc9qlzN8TgJlIGd7s8Yt5xYzhqopCYChMhyK+JKiO7rb1M7Za eDLbM5xWx8yY/7MgPtr1GNCEuB3eUKhusLSsux4XCBc5dqVr6oh7tKfObbkU81jIcdIm HqZWmE0KR6d4js5rIkT81KyFPuI3uRSyoJBvxIEesl6TEoeopLAhJmI8hRpKMswQ1aZ9 xhB+NuQGu1ynKcg0/qNzufJQVP274OWobusbnkM11mViaxmZIxXf1VAYZNhoVptiaMKx kgSg== 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=3w8vioXEmI8V8oqsMvcWy54VmNrkR15Nyip/YpPR8M0=; b=Jb8uYYsfRZ3YRsERHxgo+hdWLoH7gCLZC6Zew23leo6UaF5A3uhtZp421TKVx7g2mz psjKI9BP5QxovTDf5VBLHbYc3wl1/uY/bu/fleXY0+eR2xInI36aw0ZVQjCHx0ioxboE TPofMA0Jnwg09QkK/eT7gYCQuOo3aHH+4WLNIxxILh/7d19bgBdaUVcqJRGBQK/V1bv1 PL+zQCEta1n55GByrhQNOjzXMQYoJsgWmRtrBE2/47SAYW8SH/5MbhNbyMlqQ86aPNOn FV7S5Zrpdf5hlJVVFXUjQEA2zr08KaYErEnJclJcAyTAyqRDc3yzlr0DCWKkddalJbUa 1Dzg== 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=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id e11si8953513ejq.437.2019.11.11.02.14.05; Mon, 11 Nov 2019 02:14:29 -0800 (PST) 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=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727104AbfKKKMv (ORCPT + 99 others); Mon, 11 Nov 2019 05:12:51 -0500 Received: from mx2.suse.de ([195.135.220.15]:34292 "EHLO mx1.suse.de" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1726768AbfKKKMu (ORCPT ); Mon, 11 Nov 2019 05:12:50 -0500 X-Virus-Scanned: by amavisd-new at test-mx.suse.de Received: from relay2.suse.de (unknown [195.135.220.254]) by mx1.suse.de (Postfix) with ESMTP id 853F2B29C; Mon, 11 Nov 2019 10:12:49 +0000 (UTC) Date: Mon, 11 Nov 2019 11:12:48 +0100 From: Michal Hocko To: Qian Cai Cc: akpm@linux-foundation.org, hannes@cmpxchg.org, guro@fb.com, linux-mm@kvack.org, cgroups@vger.kernel.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH -next] mm/vmscan: fix an undefined behavior for zone id Message-ID: <20191111101248.GF1396@dhcp22.suse.cz> References: <20191108204407.1435-1-cai@lca.pw> <64E60F6F-7582-427B-8DD5-EF97B1656F5A@lca.pw> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <64E60F6F-7582-427B-8DD5-EF97B1656F5A@lca.pw> User-Agent: Mutt/1.10.1 (2018-07-13) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Fri 08-11-19 16:26:52, Qian Cai wrote: > > > > On Nov 8, 2019, at 3:44 PM, Qian Cai wrote: > > > > - for (zid = 0; zid <= zone_idx; zid++) { > > + for (zid = 0; zid < zone_idx; zid++) { > > struct zone *zone = > > Oops, I think here needs to be, > > for (zid = 0; zid <= zone_idx && zid < MAX_NR_ZONES; zid++) { > > to deal with this MAX_NR_ZONES special case. Yep this looks correct. Thanks! -- Michal Hocko SUSE Labs