Re: [PATCH -next] mm/vmscan: fix an undefined behavior for zone id

From: Qian Cai
Date: Fri Nov 08 2019 - 16:26:59 EST




> On Nov 8, 2019, at 3:44 PM, Qian Cai <cai@xxxxxx> 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.