Received: by 2002:ac0:a5b6:0:0:0:0:0 with SMTP id m51-v6csp3476972imm; Mon, 4 Jun 2018 04:22:09 -0700 (PDT) X-Google-Smtp-Source: ADUXVKLPJACrVTkeYBEw4OZTIwwfjyMr3retBBnnWkW7t5A+CNj0at83LzXU0osPUREHXrG4jQEp X-Received: by 2002:a63:9f1a:: with SMTP id g26-v6mr4775376pge.178.1528111328986; Mon, 04 Jun 2018 04:22:08 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1528111328; cv=none; d=google.com; s=arc-20160816; b=dtLO7bb26JK08By+I9prOXnfAKpOqWr034wok/PRMaE12i6KqbWgE6aKRDG1wDwF9M stYBqMhz+5m9B1PpVGd5inM1GKJqv6PuZDJ+Wqix0B/khDdsC73pGzxp4xqd4OllMP+c 3RYKl9BA/vxiG5ebq67qzKXWvvXd7pnq1EzVwALjo9ZdhM5koXk7W+0JKdsFZ+V2tjUi LAljGn6Mo6nacwSGMqFz1dq4O3kdMk1AALSDgBCD7F8Huo/SJTAgBigbkJs11B+lzvuO 2Lf5Al0McjvKtaQycm88b8NGXoBHiDvKWCyQDVgzLyYJGfWplsGnDpz+FM9kl4O+g9+f 6wFg== 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:arc-authentication-results; bh=1i6j7rtJmdc8eAqnX+e+nG/kEWJbB1c3d1C1f7uqZQA=; b=VYV0/GYUv3uDeXFmTFk5psB4t3vujEHswyf6mjdOpCsyQCg0G7a1k2BzwbGU27ezY9 KwTJbBtfBmGNbO+zdquDgx37RP4TIqckmVzbQZlrcRdWq7N1PeB9gfn8cG1iu3UlXpwn N91R/bGoMkd7CI2HdNXJcHPZwtQwiqWwllgCZoeD7XG8J5lZZ7OliONN+NpgbPR9lNwP iKTfxo9vCFXOSeQLPFM9BZcwLRmMlNCPhHDJS6mE/cmY+BBhQv4EGSV4+OkC0D1NxHAi 34rQQKlSDU1ATP7U01Vg6fPHU+NJeEUKPetJ6jweA+H2hRHFaLAhTTLtpArSRFv29sTZ MwxQ== 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 h71-v6si5883308pfe.332.2018.06.04.04.21.53; Mon, 04 Jun 2018 04:22:08 -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=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752409AbeFDLUa (ORCPT + 99 others); Mon, 4 Jun 2018 07:20:30 -0400 Received: from mx2.suse.de ([195.135.220.15]:39486 "EHLO mx2.suse.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751473AbeFDLU3 (ORCPT ); Mon, 4 Jun 2018 07:20:29 -0400 X-Virus-Scanned: by amavisd-new at test-mx.suse.de Received: from relay2.suse.de (charybdis-ext-too.suse.de [195.135.220.254]) by mx2.suse.de (Postfix) with ESMTP id EEA49AE35; Mon, 4 Jun 2018 11:20:27 +0000 (UTC) Date: Mon, 4 Jun 2018 13:20:26 +0200 From: Michal Hocko To: nixiaoming Cc: akpm@linux-foundation.org, vdavydov.dev@gmail.com, hannes@cmpxchg.org, garsilva@embeddedor.com, ktkhai@virtuozzo.com, stummala@codeaurora.org, linux-kernel@vger.kernel.org, linux-mm@kvack.org Subject: Re: [PATCH] mm: Add conditions to avoid out-of-bounds Message-ID: <20180604112026.GI19202@dhcp22.suse.cz> References: <20180604103735.42781-1-nixiaoming@huawei.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20180604103735.42781-1-nixiaoming@huawei.com> User-Agent: Mutt/1.9.5 (2018-04-13) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Mon 04-06-18 18:37:35, nixiaoming wrote: > In the function memcg_init_list_lru > if call goto fail when i == 0, will cause out-of-bounds at lru->node[i] How? All I can see is that the fail path does for (i = i - 1; i >= 0; i--) so it will not do anything for i=0. -- Michal Hocko SUSE Labs