From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-10.2 required=3.0 tests=BAYES_00, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER,MAILING_LIST_MULTI, SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED,USER_AGENT_SANE_1 autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 16A44C43460 for ; Fri, 7 May 2021 10:26:42 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id 7FED46143F for ; Fri, 7 May 2021 10:26:40 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 7FED46143F Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=techsingularity.net Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=owner-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix) id 0ECEF8D0009; Fri, 7 May 2021 06:26:40 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 09D428D0006; Fri, 7 May 2021 06:26:40 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id E80568D0009; Fri, 7 May 2021 06:26:39 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0223.hostedemail.com [216.40.44.223]) by kanga.kvack.org (Postfix) with ESMTP id CA13B8D0006 for ; Fri, 7 May 2021 06:26:39 -0400 (EDT) Received: from smtpin35.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay04.hostedemail.com (Postfix) with ESMTP id 8913F442C for ; Fri, 7 May 2021 10:26:39 +0000 (UTC) X-FDA: 78114056118.35.B84B1FB Received: from outbound-smtp46.blacknight.com (outbound-smtp46.blacknight.com [46.22.136.58]) by imf16.hostedemail.com (Postfix) with ESMTP id 9672D80192E2 for ; Fri, 7 May 2021 10:26:29 +0000 (UTC) Received: from mail.blacknight.com (pemlinmail02.blacknight.ie [81.17.254.11]) by outbound-smtp46.blacknight.com (Postfix) with ESMTPS id D7675FAB37 for ; Fri, 7 May 2021 11:26:35 +0100 (IST) Received: (qmail 12395 invoked from network); 7 May 2021 10:26:35 -0000 Received: from unknown (HELO techsingularity.net) (mgorman@techsingularity.net@[84.203.16.112]) by 81.17.254.9 with ESMTPSA (AES256-SHA encrypted, authenticated); 7 May 2021 10:26:35 -0000 Date: Fri, 7 May 2021 11:26:34 +0100 From: Mel Gorman To: Rasmus Villemoes Cc: Andrew Morton , Alexander Lobakin , Vlastimil Babka , linux-mm@kvack.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH] mm/page_alloc: __alloc_pages_bulk(): do bounds check before accessing array Message-ID: <20210507102634.GD9524@techsingularity.net> References: <20210507064504.1712559-1-linux@rasmusvillemoes.dk> MIME-Version: 1.0 Content-Type: text/plain; charset=iso-8859-15 Content-Disposition: inline In-Reply-To: <20210507064504.1712559-1-linux@rasmusvillemoes.dk> User-Agent: Mutt/1.10.1 (2018-07-13) Authentication-Results: imf16.hostedemail.com; dkim=none; spf=pass (imf16.hostedemail.com: domain of mgorman@techsingularity.net designates 46.22.136.58 as permitted sender) smtp.mailfrom=mgorman@techsingularity.net; dmarc=none X-Rspamd-Server: rspam03 X-Stat-Signature: f6n7nwamctgmhoawoqh3945skrt6nxgc X-Rspamd-Queue-Id: 9672D80192E2 Received-SPF: none (techsingularity.net>: No applicable sender policy available) receiver=imf16; identity=mailfrom; envelope-from=""; helo=outbound-smtp46.blacknight.com; client-ip=46.22.136.58 X-HE-DKIM-Result: none/none X-HE-Tag: 1620383189-802643 X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: On Fri, May 07, 2021 at 08:45:03AM +0200, Rasmus Villemoes wrote: > In the event that somebody would call this with an already fully > populated page_array, the last loop iteration would do an access > beyond the end of page_array. > > It's of course extremely unlikely that would ever be done, but this > triggers my internal static analyzer. Also, if it really is not > supposed to be invoked this way (i.e., with no NULL entries in > page_array), the nr_populated instead. > > Fixes: 0f87d9d30f21 (mm/page_alloc: add an array-based interface to the bulk page allocator) > Signed-off-by: Rasmus Villemoes Acked-by: Mel Gorman -- Mel Gorman SUSE Labs